@@ -59,7 +59,7 @@ constexpr auto getCurrentCompilerId() {
5959 constexpr auto osCompilerIdNew = bnch_swt::internal::to_lower (compilerId);
6060 if constexpr (osCompilerIdNew.operator std::string_view ().contains (" gnu" ) || osCompilerIdNew.operator std::string_view ().contains (" gcc" ) ||
6161 osCompilerIdNew.operator std::string_view ().contains (" g++" )) {
62- return bnch_swt::string_literal{ " GNUCXX " };
62+ return bnch_swt::string_literal{ " GCC " };
6363 } else if constexpr (osCompilerIdNew.operator std::string_view ().contains (" clang" ) || osCompilerIdNew.operator std::string_view ().contains (" appleclang" )) {
6464 return bnch_swt::string_literal{ " CLANG" };
6565 } else if constexpr (osCompilerIdNew.operator std::string_view ().contains (" msvc" )) {
@@ -144,7 +144,7 @@ std::string getCPUInfo() {
144144}
145145
146146void executePythonScript (const std::string& scriptPath, const std::string& argument01, const std::string& argument02) {
147- #if JSONIFIER_PLATFORM_WINDOWS
147+ #if defined(JSONIFIER_WIN)
148148 static std::string pythonName{ " python " };
149149#else
150150 static std::string pythonName{ " python3 " };
@@ -186,75 +186,29 @@ template<typename value_type> struct partial_test {
186186};
187187
188188struct test_generator {
189- static constexpr std::string_view charSet{ " !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~!#$%&'()*+,-./"
190- " 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~!#$%&'()*+,-./"
191- " 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~!#$%&'()*+,-./"
192- " 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~\"\\\b\f\n\r\t " };
193- inline static std::uniform_real_distribution<double > disDouble{ log (std::numeric_limits<double >::min ()), log (std::numeric_limits<double >::max ()) };
194- inline static std::uniform_int_distribution<int64_t > disInt{ std::numeric_limits<int64_t >::min (), std::numeric_limits<int64_t >::max () };
195- inline static std::uniform_int_distribution<uint64_t > disUint{ std::numeric_limits<uint64_t >::min (), std::numeric_limits<uint64_t >::max () };
196- inline static std::uniform_int_distribution<uint64_t > disCharSet{ 0ull , charSet.size () - 1 };
197- inline static std::uniform_int_distribution<uint64_t > disString{ 16ull , 64ull };
198- inline static std::uniform_int_distribution<uint64_t > disUnicodeEmoji{ 0ull , std::size (unicode_emoji::unicodeEmoji) - 1 };
199- inline static std::uniform_int_distribution<uint64_t > disBool{ 0 , 100 };
200- inline static std::random_device randomEngine{};
201- inline static std::mt19937_64 gen{ randomEngine () };
202-
203- template <jsonifier::concepts::integer_t value_type01, jsonifier::concepts::integer_t value_type02>
204- static value_type01 randomizeNumberUniform (value_type01 start, value_type02 end) {
205- std::uniform_int_distribution<value_type01> dis{ start, static_cast <value_type01>(end) };
206- return dis (gen);
207- }
208-
209189 template <jsonifier::concepts::string_t value_type> static value_type generateValue () {
210- auto length{ disString (gen) };
211-
212- std::string result{};
213- for (uint64_t x = 0 ; x < length; ++x) {
214- result += charSet[disCharSet (gen)];
215- }
216-
217- return result;
190+ return bnch_swt::random_generator<std::string>::impl (bnch_swt::random_generator<uint64_t >::impl (16ull , 64ull ));
218191 }
219192
220193 template <jsonifier::concepts::float_t value_type> static value_type generateValue () {
221- double logValue = disDouble (gen);
222- bool negative{ generateValue<bool >() };
223- return negative ? -std::exp (logValue) : std::exp (logValue);
194+ return bnch_swt::random_generator<double >::impl ();
224195 }
225196
226197 template <jsonifier::concepts::bool_t value_type> static value_type generateValue () {
227- return static_cast <bool >( disBool (gen) >= 50 );
198+ return bnch_swt::random_generator <bool >:: impl ( );
228199 }
229200
230201 template <jsonifier::concepts::uns64_t value_type> static value_type generateValue () {
231- size_t length{ randomizeNumberUniform (1ull , 20ull ) };
232-
233- uint64_t min_val = (length == 1 ) ? 0 : static_cast <uint64_t >(std::pow (10 , length - 1 ));
234- uint64_t max_val = static_cast <uint64_t >(std::pow (10 , length)) - 1 ;
235- if (min_val > max_val) {
236- std::swap (min_val, max_val);
237- }
238- std::uniform_int_distribution<uint64_t > dis (min_val, max_val);
239- return dis (gen);
202+ return bnch_swt::random_generator<uint64_t >::impl ();
240203 }
241204
242205 template <jsonifier::concepts::sig64_t value_type> static value_type generateValue () {
243- size_t length{ randomizeNumberUniform (1ull , 19ull ) };
244-
245- int64_t min_val = (length == 1 ) ? 0 : static_cast <int64_t >(std::pow (10 , length - 1 ));
246- int64_t max_val = static_cast <int64_t >(std::pow (10 , length)) - 1 ;
247- if (min_val > max_val) {
248- std::swap (min_val, max_val);
249- }
250- std::uniform_int_distribution<int64_t > dis (min_val, max_val);
251- auto returnValue{ dis (gen) };
252- return generateValue<bool >() ? returnValue : -returnValue;
206+ return bnch_swt::random_generator<int64_t >::impl ();
253207 }
254208
255209 static test_struct generateTestStruct () {
256210 test_struct returnValues{};
257- returnValues.testBool = generateValue<bool >();
211+ returnValues.testBool = generateValue<bool >();
258212 returnValues.testDouble = generateValue<double >();
259213 returnValues.testInt = generateValue<int64_t >();
260214 returnValues.testUint = generateValue<uint64_t >();
@@ -276,7 +230,7 @@ struct test_generator {
276230 static test<test_struct> generateTest () {
277231 test<test_struct> returnValues{};
278232 auto fill = [&](auto & v) {
279- const auto arraySize01 = randomizeNumberUniform (1ull , 15ull );
233+ const auto arraySize01 = bnch_swt::random_generator< uint64_t >:: impl (1ull , 15ull );
280234 v.resize (arraySize01);
281235 for (uint64_t x = 0 ; x < arraySize01; ++x) {
282236 v[x] = generateTestStruct ();
@@ -459,7 +413,7 @@ struct test_results {
459413};
460414
461415std::tm getTime () {
462- #if JSONIFIER_PLATFORM_WINDOWS
416+ #if defined(JSONIFIER_WIN)
463417 std::time_t result = std::time (nullptr );
464418 std::tm resultTwo{};
465419 localtime_s (&resultTwo, &result);
0 commit comments