From b268bab8adf6b8216c8889d4e44336ce5196ce3b Mon Sep 17 00:00:00 2001
From: i7-8700 <1281261856@qq.com>
Date: Tue, 1 Oct 2019 00:13:01 +0800
Subject: [PATCH] test rand

---
 jlib/util/rand.h                         |   3 +-
 test/test.sln                            |  16 ++-
 test/test/test.cpp                       |  18 ++--
 test/test_rand/test_rand.cpp             |   7 ++
 test/test_rand/test_rand.vcxproj         | 131 +++++++++++++++++++++++
 test/test_rand/test_rand.vcxproj.filters |  22 ++++
 test/test_rand/test_rand.vcxproj.user    |   4 +
 7 files changed, 189 insertions(+), 12 deletions(-)
 create mode 100644 test/test_rand/test_rand.cpp
 create mode 100644 test/test_rand/test_rand.vcxproj
 create mode 100644 test/test_rand/test_rand.vcxproj.filters
 create mode 100644 test/test_rand/test_rand.vcxproj.user

diff --git a/jlib/util/rand.h b/jlib/util/rand.h
index 1d7f9ab..124817f 100644
--- a/jlib/util/rand.h
+++ b/jlib/util/rand.h
@@ -8,7 +8,8 @@ namespace jlib
 {
 
 template <class T = std::mt19937, std::size_t N = T::state_size>
-inline auto seeded_random_engine() -> typename std::enable_if<!!N, T>::type {
+inline typename std::enable_if<!!N, T>::type
+seeded_random_engine() {
 	typename T::result_type random_data[N];
 	std::random_device source;
 	std::generate(std::begin(random_data), std::end(random_data), std::ref(source));
diff --git a/test/test.sln b/test/test.sln
index c5db8f0..7bf4b04 100644
--- a/test/test.sln
+++ b/test/test.sln
@@ -219,6 +219,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_wmi", "test_wmi\test_w
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testDeviceUniqueIdentifier", "testDeviceUniqueIdentifier\testDeviceUniqueIdentifier.vcxproj", "{CA7812A3-9E48-4A94-B39A-32EED587E38A}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "util_tests", "util_tests", "{ABCB8CF8-5E82-4C47-A0FC-E82DF105DF99}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_rand", "test_rand\test_rand.vcxproj", "{4AB0552E-F2D7-4FF0-B019-90D83847A25C}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|x64 = Debug|x64
@@ -329,6 +333,14 @@ Global
 		{CA7812A3-9E48-4A94-B39A-32EED587E38A}.Release|x64.Build.0 = Release|x64
 		{CA7812A3-9E48-4A94-B39A-32EED587E38A}.Release|x86.ActiveCfg = Release|Win32
 		{CA7812A3-9E48-4A94-B39A-32EED587E38A}.Release|x86.Build.0 = Release|Win32
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Debug|x64.ActiveCfg = Debug|x64
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Debug|x64.Build.0 = Debug|x64
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Debug|x86.ActiveCfg = Debug|Win32
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Debug|x86.Build.0 = Debug|Win32
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Release|x64.ActiveCfg = Release|x64
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Release|x64.Build.0 = Release|x64
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Release|x86.ActiveCfg = Release|Win32
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C}.Release|x86.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -358,7 +370,7 @@ Global
 		{823DD7B5-4815-4132-8D28-A5AFBC70DF45} = {513FCA46-EB27-422D-8B65-BAB4AA594D43}
 		{41E61D5E-42D7-4EEA-A6B5-3D13DB455848} = {5A2CA1BE-5A4B-41B0-B74A-F86AB433F4A5}
 		{F441BB78-6FE1-4FCB-80C3-9FC5F8131996} = {5A2CA1BE-5A4B-41B0-B74A-F86AB433F4A5}
-		{175611D7-9C38-4269-B0B4-66DE9555A8EB} = {21DC893D-AB0B-48E1-9E23-069A025218D9}
+		{175611D7-9C38-4269-B0B4-66DE9555A8EB} = {ABCB8CF8-5E82-4C47-A0FC-E82DF105DF99}
 		{D9BC4E5B-7E8F-4C86-BF15-CCB75CBC256F} = {21DC893D-AB0B-48E1-9E23-069A025218D9}
 		{F118E1C9-F461-4CAA-A0F1-75F5A5C8ADF3} = {42703978-A988-403D-9723-E35527FA8A07}
 		{0E82BB61-0D27-42B4-8F11-98DB2A21C168} = {F118E1C9-F461-4CAA-A0F1-75F5A5C8ADF3}
@@ -367,6 +379,8 @@ Global
 		{904EC99B-A012-4134-AE6F-E21635FB602F} = {0E6598D3-602D-4552-97F7-DC5AB458D553}
 		{79A2C0A6-B8BB-406F-A732-C6300A611EC8} = {0E6598D3-602D-4552-97F7-DC5AB458D553}
 		{CA7812A3-9E48-4A94-B39A-32EED587E38A} = {0E6598D3-602D-4552-97F7-DC5AB458D553}
+		{ABCB8CF8-5E82-4C47-A0FC-E82DF105DF99} = {21DC893D-AB0B-48E1-9E23-069A025218D9}
+		{4AB0552E-F2D7-4FF0-B019-90D83847A25C} = {ABCB8CF8-5E82-4C47-A0FC-E82DF105DF99}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {A8EBEA58-739C-4DED-99C0-239779F57D5D}
diff --git a/test/test/test.cpp b/test/test/test.cpp
index 283a0cd..76f0d58 100644
--- a/test/test/test.cpp
+++ b/test/test/test.cpp
@@ -2,19 +2,17 @@
 //
 
 #define _CRT_SECURE_NO_WARNINGS
-#include "jlib/chrono_wrapper.h"
+#include "jlib/util/chrono_wrapper.h"
 #include "jlib/dp.h"
 #include "jlib/log2.h"
-#include "jlib/mem_tool.h"
-#include "jlib/micro_getter_setter.h"
-#include "jlib/net.h"
-#include "jlib/space.h"
-#include "jlib/std_util.h"
+#include "jlib/util/mem_tool.h"
+#include "jlib/util/micro_getter_setter.h"
+//#include "jlib/net.h"
+#include "jlib/util/space.h"
+#include "jlib/util/std_util.h"
 #include "jlib/utf8.h"
-#include "jlib/version_no.h"
-#include "jlib/vs_ver.h"
-#include "jlib/win32.h"
-#include <jlib/3rdparty/win32/Registry.hpp>
+#include "jlib/util/version_no.h"
+//#include "jlib/win32.h"
 
 
 int main()
diff --git a/test/test_rand/test_rand.cpp b/test/test_rand/test_rand.cpp
new file mode 100644
index 0000000..29d1718
--- /dev/null
+++ b/test/test_rand/test_rand.cpp
@@ -0,0 +1,7 @@
+#include "../../jlib/util/rand.h"
+#include <stdio.h>
+
+int main()
+{
+	printf("%s\n", jlib::nonce().data());
+}
diff --git a/test/test_rand/test_rand.vcxproj b/test/test_rand/test_rand.vcxproj
new file mode 100644
index 0000000..bdacac9
--- /dev/null
+++ b/test/test_rand/test_rand.vcxproj
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <ProjectGuid>{4AB0552E-F2D7-4FF0-B019-90D83847A25C}</ProjectGuid>
+    <RootNamespace>testrand</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="test_rand.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/test/test_rand/test_rand.vcxproj.filters b/test/test_rand/test_rand.vcxproj.filters
new file mode 100644
index 0000000..9706f62
--- /dev/null
+++ b/test/test_rand/test_rand.vcxproj.filters
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="test_rand.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/test/test_rand/test_rand.vcxproj.user b/test/test_rand/test_rand.vcxproj.user
new file mode 100644
index 0000000..88a5509
--- /dev/null
+++ b/test/test_rand/test_rand.vcxproj.user
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>
\ No newline at end of file
-- 
2.18.1