diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8423d15 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "3rd_party/iutest"] + path = 3rd_party/iutest + url = https://github.com/srz-zumix/iutest.git diff --git a/3rd_party/iutest b/3rd_party/iutest new file mode 160000 index 0000000..8ebf87d --- /dev/null +++ b/3rd_party/iutest @@ -0,0 +1 @@ +Subproject commit 8ebf87da8dce295b0d7539652edb90abcc56c89d diff --git a/dxlibex/basic_types/distance_result_type_t.hpp b/dxlibex/basic_types/distance_result_type_t.hpp index 28d7d98..895cd0e 100644 --- a/dxlibex/basic_types/distance_result_type_t.hpp +++ b/dxlibex/basic_types/distance_result_type_t.hpp @@ -16,7 +16,7 @@ namespace dxle { template struct distance_result_type_impl { typedef T type; - }; + }; template struct distance_result_type_impl { typedef double type;//If any argument has integral type, it is cast to double. diff --git a/dxlibex/basic_types/point2d.hpp b/dxlibex/basic_types/point2d.hpp index eab16fc..8536a2b 100644 --- a/dxlibex/basic_types/point2d.hpp +++ b/dxlibex/basic_types/point2d.hpp @@ -637,7 +637,7 @@ namespace dxle { \~english @return Computed result. */ template - DXLE_CONSTEXPR double cross(const point_c& p1, const point_c& p2) + DXLE_CONSTEXPR double cross(const point_c& p1, const point_c& p2) DXLE_NOEXCEPT_IF_EXPR(( static_cast_if::value>(std::declval()) * std::declval() + static_cast_if::value>(std::declval()) * std::declval() @@ -657,7 +657,7 @@ namespace dxle { \~english @return Computed result. */ template - distance_result_type_t distance(const point_c& p1, const point_c& p2) + distance_result_type_t distance(const point_c& p1, const point_c& p2) DXLE_NOEXCEPT_IF_EXPR(hypot(safe_dist(std::declval(), std::declval()), safe_dist(std::declval(), std::declval()))) { return hypot(safe_dist(p1.x, p2.x), safe_dist(p1.y, p2.y)); diff --git a/dxlibex/basic_types/point3d.hpp b/dxlibex/basic_types/point3d.hpp index 09e4d01..9f72bdc 100644 --- a/dxlibex/basic_types/point3d.hpp +++ b/dxlibex/basic_types/point3d.hpp @@ -128,7 +128,7 @@ namespace dxle { //!1. operator bool //!2. operator != (nullptr) //!3. default constector + operator != - DXLE_CONSTEXPR explicit operator bool() + DXLE_CONSTEXPR explicit operator bool() const DXLE_NOEXCEPT_IF_EXPR((dxle::detail::operator_bool_helper(std::declval(), std::declval(), std::declval()))) { return dxle::detail::operator_bool_helper(this->x, this->y, this->z); @@ -640,7 +640,7 @@ namespace dxle { \~japanese @return 計算結果。 \~english @return Computed result. */ - template + template distance_result_type_t distance(const point3d_c& p1, const point3d_c& p2) DXLE_NOEXCEPT_IF_EXPR(hypot(safe_dist(std::declval(), std::declval()), safe_dist(std::declval(), std::declval()))) { diff --git a/tests/include/math.hpp b/tests/include/math.hpp new file mode 100644 index 0000000..af789c7 --- /dev/null +++ b/tests/include/math.hpp @@ -0,0 +1,51 @@ +/*============================================================================= +Copyright (C) 2015-2017 DxLibEx project +https://github.com/Nagarei/DxLibEx/ + +Distributed under the Boost Software License, Version 1.0. +(See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef DXLE_TESTS_INCLUDE_MATH_HPP_ +#define DXLE_TESTS_INCLUDE_MATH_HPP_ +namespace detail { + template::value> + struct inferior_sqrt_helper { + T operator()(T x) { return static_cast(::std::sqrt(x)); } + }; + template + struct inferior_sqrt_helper { + T operator()(T x) { return (x < 0) ? 0 : static_cast(::std::sqrt(x)); } + }; +} +template +T inferior_sqrt(T x) { return detail::inferior_sqrt_helper()(x); } +inline std::uint64_t inferior_sqrt(const std::uint64_t x) +{ + if (x < static_cast(std::numeric_limits::max())) return static_cast(::std::sqrt(x)); + std::uint64_t s = 1U; + auto t = x; + while (s < t) { s <<= 1; t >>= 1; } + do { + t = s; + s = (x / s + s) >> 1; + } while (s < t); + return t; +} +inline std::int64_t inferior_sqrt(const std::int64_t x) +{ + return (x < 0) ? 0 : x < static_cast(std::numeric_limits::max()) ? static_cast(::std::sqrt(x)) + : static_cast(inferior_sqrt(static_cast(x))); +} +namespace detail { + template::value> + struct inferior_sqrt2_helper { + T operator()(T x) { return inferior_sqrt(x); } + }; + template + struct inferior_sqrt2_helper { + T operator()(T x) { return (x < 0) ? -inferior_sqrt(-x) : inferior_sqrt(x); } + }; +} +template +T inferior_sqrt2(T x) { return detail::inferior_sqrt2_helper()(x); } +#endif //DXLE_TESTS_INCLUDE_MATH_HPP_ diff --git a/tests/include/random.hpp b/tests/include/random.hpp new file mode 100644 index 0000000..798c724 --- /dev/null +++ b/tests/include/random.hpp @@ -0,0 +1,241 @@ +/*============================================================================= +Copyright (C) 2015-2017 DxLibEx project +https://github.com/Nagarei/DxLibEx/ + +Distributed under the Boost Software License, Version 1.0. +(See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef DXLE_TESTS_INCLUDE_RANDOM_HPP_ +#define DXLE_TESTS_INCLUDE_RANDOM_HPP_ +#if defined(__MINGW32__) && !defined(__clang__) + //mingw-gcc's std::randome_device is broken. + //gccをwindowsで使うならstd::random_deviceを使ってはいけない - Qiita + //http://qiita.com/nanashi/items/f94b78398a6c79d939e1 +# define _CRT_RAND_S +# include //rand_s +# include +#endif //defined(__MINGW32__) && !defined(__clang__) +#if defined(_WIN32) || defined(_WIN64) +# define DXLE_ARC_FOR_WINDWOS 1 +# if !defined(CINTERFACE) && defined(__c2__) && __clang_major__ == 3 && __clang_minor__ == 8 +//To avoid compile error +//C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229,21): error : unknown type name 'IUnknown' +// static_cast(*pp); // make sure everyone derives from IUnknown +# define CINTERFACE +# endif +# include +# include +#elif defined(__linux__) +# define DXLE_ARC_FOR_LINUX 1 +# include +# include +# include +namespace dxle { + inline unsigned int get_randome_from_dev_random() { + std::ifstream file("/dev/random", std::ios::binary); + if (file.is_open()) + { + char buf[sizeof(unsigned int)]; + file.read(buf, sizeof(unsigned int)); + file.close(); + return *reinterpret_cast(buf); + } + return 0; + } +} +#endif +#include +#include +#include +#include //std::generate +#include //clock(), time() +#include //std::ref in gcc +#include +#include +#include +#include +#include +#if !defined(__c2__) || (defined(__clang__) && (__clang_major__ >= 4 ) || __clang_major__ == 3 && __clang_minor__ >= 9)//古いClang with Microsoft CodeGenはasmに対応していない +# ifndef __INTEL_COMPILER +# include +# if defined(_WIN32) || defined(_WIN64) +# include +# else +# include +# endif //defined(_WIN32) || defined(_WIN64) +# ifdef __GNUC__ +# include +# endif //__GNUC__ +# endif //__INTEL_COMPILER +namespace dxle { + using std::uint32_t; + namespace intrin { + struct regs_t { uint32_t EAX, EBX, ECX, EDX; }; + union register_str_cvt { + uint32_t u32[3]; + char str[12]; + }; + inline regs_t get_cpuid(unsigned int level) { + regs_t re = { 0 }; + static_assert(sizeof(re) == (sizeof(uint32_t) * 4), "illegal size of struct regs_t "); +# if defined(__INTEL_COMPILER) || defined(_MSC_VER) && !defined(__clang__) + __cpuid(reinterpret_cast(&re), static_cast(level)); +# elif defined(__GNUC__) + __get_cpuid(level, &re.EAX, &re.EBX, &re.ECX, &re.EDX); +# endif + return re; + } + inline bool check_vender(const char* s) { + const auto id = get_cpuid(0); + register_str_cvt vender = { { id.EBX, id.EDX, id.ECX } }; + return (0 == std::memcmp(vender.str, s, sizeof(vender.str))); + } + inline bool IsIntelCPU() { + static const auto is_intel_cpu = check_vender("GenuineIntel");//実行中にCPUは変わらないとする + return is_intel_cpu; + } + inline bool IsAMDCPU() { + static const auto is_amd_cpu = check_vender("AuthenticAMD"); + return is_amd_cpu; + } + inline bool IsRDRANDsupport() { + DXLE_STATIC_CONSTEXPR uint32_t RDRAND_MASK = 1U << 30U; + if (!IsIntelCPU() && !IsAMDCPU()) return false; + const auto reg = get_cpuid(1);//If RDRAND is supported, the bit 30 of the ECX register is set after calling CPUID standard function 01H. + return (RDRAND_MASK == (reg.ECX & RDRAND_MASK)); + } + inline bool IsRDSEEDsupport() { + DXLE_STATIC_CONSTEXPR uint32_t RDSEED_MASK = 1U << 18U; + if (!IsIntelCPU()) return false; + const auto reg = get_cpuid(7);//If RDSEED is supported, the bit 18 of the EBX register is set after calling CPUID standard function 07H. + return (RDSEED_MASK == (reg.EBX & RDSEED_MASK)); + } + } +} +#else +# define DXLE_NO_ASM +#endif//!defined(_MSC_VER) || !defined(__clang__) +namespace dxle { + namespace detail { + template + struct vector_push_back_helper { + Pointer value; + }; + template + struct vector_push_back_operator_impl { + void operator()(std::vector& v, vector_push_back_helper info) { + if (info.value) v.push_back((value_type)(info.value)); + } + }; + template + struct vector_push_back_operator_impl { + void operator()(std::vector& v, vector_push_back_helper info) { + if (info.value) v.push_back(info.value); + } + }; + template + struct vector_push_back_operator_impl { + void operator()(std::vector& v, vector_push_back_helper info) { + DXLE_STATIC_CONSTEXPR size_t size_time = sizeof(T) / sizeof(value_type); + DXLE_STATIC_CONSTEXPR size_t rshft_num = sizeof(value_type) * CHAR_BIT; + for (size_t i = 0; i < size_time; ++i) { + const auto tmp = static_cast((std::uintmax_t)(info.value) >> (rshft_num * i)); + if (tmp) v.push_back(tmp); + } + } + }; + template::value || std::is_arithmetic::value, std::nullptr_t> = nullptr> + inline void operator| (std::vector& v, vector_push_back_helper info) { + vector_push_back_operator_impl ()(v, info); + } + } +} +namespace dxle { + template + dxle::detail::vector_push_back_helper push_back(T pointer) { return{ pointer }; } + using seed_v_t = std::vector; + inline seed_v_t create_seed_v() { + const auto begin_time = std::chrono::high_resolution_clock::now(); +#if defined(__c2__) && __clang_minor__ < 9 + constexpr std::size_t randome_device_generate_num = 12;//Clnag with Microsoft CodeGen does not support RDRND/RDSEED so that use std::random_device agressively. +#else + DXLE_STATIC_CONSTEXPR std::size_t randome_device_generate_num = 9; +#endif + seed_v_t sed_v(randome_device_generate_num);// 初期化用ベクター +#ifndef _CRT_RAND_S + std::random_device rnd;// ランダムデバイス + std::generate(sed_v.begin(), sed_v.end(), std::ref(rnd));// ベクタの初期化 +#else //_CRT_RAND_S + std::generate(sed_v.begin(), sed_v.end(), []() { + unsigned int re; + if (rand_s(&re)) { + std::this_thread::sleep_for(std::chrono::milliseconds(300)); + if (auto err = rand_s(&re)) throw std::runtime_error("rand_s failed. error code:" + std::to_string(err)); + } + return re; + });// ベクタの初期化 +#endif //_CRT_RAND_S +#ifndef DXLE_NO_ASM + if (intrin::IsRDRANDsupport()) {//RDRAND命令の結果もベクターに追加 + for (unsigned int i = 0; i < 4; i++) { + unsigned int rdrand_value = 0; +# if defined(_MSC_VER) || defined(__INTEL_COMPILER) + _rdrand32_step(&rdrand_value); +# else//defined(_MSC_VER) || defined(__INTEL_COMPILER) + __builtin_ia32_rdrand32_step(&rdrand_value); +# endif//defined(_MSC_VER) || defined(__INTEL_COMPILER) + if (0 != rdrand_value) { + sed_v.push_back((rdrand_value < std::numeric_limits::max() - i) ? rdrand_value + i : rdrand_value); + } + } + } + if (intrin::IsRDSEEDsupport()) { + for (unsigned int i = 0; i < 5; i++) { + unsigned int rdseed_value = 0; +# if defined(_MSC_VER) || defined(__INTEL_COMPILER) + _rdseed32_step(&rdseed_value); +# else//defined(_MSC_VER) || defined(__INTEL_COMPILER) + __builtin_ia32_rdseed32_step(&rdseed_value); +# endif//defined(_MSC_VER) || defined(__INTEL_COMPILER) + if (0 != rdseed_value) { + sed_v.push_back((rdseed_value < std::numeric_limits::max() - i) ? rdseed_value + i : rdseed_value); + } + } + } +#endif//!defined(DXLE_NO_ASM) +#ifdef DXLE_ARC_FOR_WINDWOS + POINT point; + GetCursorPos(&point); + sed_v | push_back(point.x); + sed_v | push_back(point.y); + sed_v | push_back(GetCurrentProcessId()); +#endif //DXLE_ARC_FOR_WINDWOS +#ifdef DXLE_ARC_FOR_LINUX + sed_v | push_back(get_randome_from_dev_random()); + sed_v | push_back(getppid()); + sed_v | push_back(get_randome_from_dev_random()); +#endif + sed_v | push_back(clock());//clock関数の結果もベクターに追加 + sed_v | push_back(time(nullptr));//time関数の結果もベクターに追加 + //ヒープ領域のアドレスもベクターに追加 + auto heap = std::make_unique(); + sed_v | push_back(heap.get()); + sed_v | push_back(&heap); + sed_v | push_back(time); + const auto end_time = std::chrono::high_resolution_clock::now(); + sed_v | push_back((end_time - begin_time).count()); + return sed_v; + } + inline std::mt19937 create_engine() { + auto sed_v = create_seed_v(); + std::seed_seq seq(sed_v.begin(), sed_v.end()); + return std::mt19937(seq); + } + template + using uniform_normal_distribution = dxle::first_enabled_t< + std::enable_if::value, std::uniform_int_distribution>, + std::enable_if::value, std::uniform_real_distribution> + >; +} +extern std::mt19937 engine; +#endif //DXLE_TESTS_INCLUDE_RANDOM_HPP_ diff --git a/tests/include/random_wrap.hpp b/tests/include/random_wrap.hpp new file mode 100644 index 0000000..603a0ae --- /dev/null +++ b/tests/include/random_wrap.hpp @@ -0,0 +1,97 @@ +/*============================================================================= +Copyright (C) 2015-2017 DxLibEx project +https://github.com/Nagarei/DxLibEx/ + +Distributed under the Boost Software License, Version 1.0. +(See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef DXLE_TESTS_INCLUDE_RANDOM_WRAP_HPP_ +#define DXLE_TESTS_INCLUDE_RANDOM_WRAP_HPP_ +#include "random.hpp" +template +inline T get_rand_for_add(T n1, T n2, int modifier) +{ + using lim = std::numeric_limits; + const auto minmax = std::minmax(n1, n2); + return dxle::uniform_normal_distribution( + (minmax.first > 0) ? lim::min() : lim::min() - minmax.first + modifier, + (minmax.second < 0) ? lim::max() : lim::max() - minmax.second - modifier + )(engine); +} +template +inline T get_rand_for_add(T n1, T n2, T n3, int modifier) +{ + using lim = std::numeric_limits; + const auto minmax = std::minmax({ n1, n2, n3 }); + return dxle::uniform_normal_distribution( + (minmax.first > 0) ? lim::min() : lim::min() - minmax.first + modifier, + (minmax.second < 0) ? lim::max() : lim::max() - minmax.second - modifier + )(engine); +} +template +T get_rand_for_sub(T n1, T n2, int modifier) +{ + using lim = std::numeric_limits; + const auto minmax = std::minmax(n1, n2); + return dxle::uniform_normal_distribution( + (minmax.first < 0) ? lim::min() : lim::min() + minmax.first + modifier, + (minmax.second > 0) ? lim::max() : lim::max() + minmax.second - modifier + )(engine); +} +template +T get_rand_for_sub(T n1, T n2, T n3, int modifier) +{ + using lim = std::numeric_limits; + const auto minmax = std::minmax({ n1, n2, n3 }); + return dxle::uniform_normal_distribution( + (minmax.first < 0) ? lim::min() : lim::min() + minmax.first + modifier, + (minmax.second > 0) ? lim::max() : lim::max() + minmax.second - modifier + )(engine); +} +template +T get_rand_for_div1(T n1, T n2) +{ + const auto minmax = std::minmax(n1, n2); + const auto re = dxle::uniform_normal_distribution(minmax.first, minmax.second)(engine); + return (0 != re) ? re : get_rand_for_div1(n1, n2); +} +template +T get_rand_for_div1(T n1, T n2, T n3) +{ + const auto minmax = std::minmax({ n1, n2, n3 }); + const auto re = dxle::uniform_normal_distribution(minmax.first, minmax.second)(engine); + return (0 != re) ? re : get_rand_for_div1(n1, n2, n3); +} +namespace detail { + template::value> + struct get_rand_for_div2_helper { + T operator()(T n1, T n2) + { + const auto min = std::min(n1, n2); + return get_rand_for_div1(1u, min); + } + T operator()(T n1, T n2, T n3) + { + const auto min = std::min({ n1, n2, n3 }); + return get_rand_for_div1(1u, min); + } + }; + template + struct get_rand_for_div2_helper { + T operator()(T n1, T n2) + { + const auto min = std::min(std::abs(n1), std::abs(n2)); + return get_rand_for_div1(1, min); + } + T operator()(T n1, T n2, T n3) + { + const auto min = std::min({ std::abs(n1), std::abs(n2), std::abs(n3) }); + return get_rand_for_div1(1, min); + } + }; +} +template +T get_rand_for_div2(T n1, T n2) { return detail::get_rand_for_div2_helper()(n1, n2); } +template +T get_rand_for_div2(T n1, T n2, T n3) { return detail::get_rand_for_div2_helper()(n1, n2, n3); } +#endif //DXLE_TESTS_INCLUDE_RANDOM_WRAP_HPP_ diff --git a/tests/include/utility.hpp b/tests/include/utility.hpp new file mode 100644 index 0000000..040eec6 --- /dev/null +++ b/tests/include/utility.hpp @@ -0,0 +1,21 @@ +/*============================================================================= +Copyright (C) 2015-2017 DxLibEx project +https://github.com/Nagarei/DxLibEx/ + +Distributed under the Boost Software License, Version 1.0. +(See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef DXLE_TESTS_INCLUDE_UTILITY_HPP_ +#define DXLE_TESTS_INCLUDE_UTILITY_HPP_ +#include "dxlibex/config/defines.h" +template +DXLE_CONSTEXPR bool is_l_zero(T&& val) +{ + return static_cast(0) == val; +} +template +DXLE_CONSTEXPR bool is_l_zero(T&& val, Rest&&... rest) +{ + return static_cast(0) == val && is_l_zero(std::forward(rest)...); +} +#endif //DXLE_TESTS_INCLUDE_UTILITY_HPP_ diff --git a/tests/no_dxlib.sln b/tests/no_dxlib.sln new file mode 100644 index 0000000..df15076 --- /dev/null +++ b/tests/no_dxlib.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "no_dxlib", "no_dxlib\no_dxlib.vcxproj", "{44682BAF-4F62-42D9-90EB-D7F46CD21B95}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + clang_Debug|x64 = clang_Debug|x64 + clang_Debug|x86 = clang_Debug|x86 + clang_Release|x64 = clang_Release|x64 + clang_Release|x86 = clang_Release|x86 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Debug|x64.ActiveCfg = clang_Debug|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Debug|x64.Build.0 = clang_Debug|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Debug|x86.ActiveCfg = clang_Debug|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Debug|x86.Build.0 = clang_Debug|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Release|x64.ActiveCfg = clang_Release|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Release|x64.Build.0 = clang_Release|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Release|x86.ActiveCfg = clang_Release|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.clang_Release|x86.Build.0 = clang_Release|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Debug|x64.ActiveCfg = Debug|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Debug|x64.Build.0 = Debug|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Debug|x86.ActiveCfg = Debug|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Debug|x86.Build.0 = Debug|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Release|x64.ActiveCfg = Release|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Release|x64.Build.0 = Release|x64 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Release|x86.ActiveCfg = Release|Win32 + {44682BAF-4F62-42D9-90EB-D7F46CD21B95}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/no_dxlib/basic_types/point2d.hpp b/tests/no_dxlib/basic_types/point2d.hpp new file mode 100644 index 0000000..aa78b35 --- /dev/null +++ b/tests/no_dxlib/basic_types/point2d.hpp @@ -0,0 +1,319 @@ +/*============================================================================= + Copyright (C) 2015-2017 DxLibEx project + https://github.com/Nagarei/DxLibEx/ + + Distributed under the Boost Software License, Version 1.0. + (See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#include <3rd_party/iutest/include/iutest.hpp> +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) && !defined(__c2__) +# pragma warning(disable: 4189) +#endif +template +struct basic_types_point2d : public ::iutest::Test{}; +IUTEST_TYPED_TEST_CASE(basic_types_point2d, ::iutest::Types); +IUTEST_TYPED_TEST(basic_types_point2d, construct) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value_x = get_rand(); + const auto value_y = get_rand(); + const dxle::point_c value = { value_x, value_y }; + IUTEST_ASSERT(value.x == value_x); + IUTEST_ASSERT(value.y == value_y); + } + const dxle::point_c value1 = {}; + const auto value2 = value1; + const auto value3 = std::move(value1); + IUTEST_ASSERT(is_l_zero(value1.x, value1.y, value2.x, value2.y, value3.x, value3.y)); + const dxle::point_c value4 = { 2, 12 }; + IUTEST_ASSERT(value4.x == static_cast(2)); + IUTEST_ASSERT(value4.y == static_cast(12)); +} +IUTEST_TYPED_TEST(basic_types_point2d, factory) { + using type = TypeParam; + const std::pair pa = { static_cast(12), static_cast(23) }; + const auto po = dxle::make_point_c(pa); + static_assert(std::is_same::value, "err"); + IUTEST_ASSERT(po.x == pa.first); + IUTEST_ASSERT(po.y == pa.second); + const auto po2 = dxle::make_point_c(std::pair(pa)); + IUTEST_ASSERT(po2.x == pa.first); + IUTEST_ASSERT(po2.y == pa.second); +} +IUTEST_TYPED_TEST(basic_types_point2d, operaotr_eq) { + using type = TypeParam; + const bool eq1 = 0 == dxle::point_c{} && dxle::point_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value_x = get_rand(); + const auto value_y = get_rand(); + const dxle::point_c value = { value_x, value_y }; + IUTEST_ASSERT(value == dxle::point_c(value_x, value_y)); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, ostream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + std::stringstream ss1; + ss1 << x << ", " << y; + const dxle::point_c value = { x, y }; + std::stringstream ss2; + ss2 << value; + IUTEST_ASSERT_EQ(ss1.str(), ss2.str()); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, wostream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + std::wstringstream ss1; + ss1 << x << L", " << y; + const dxle::point_c value = { x, y }; + std::wstringstream ss2; + ss2 << value; + IUTEST_ASSERT_EQ(ss1.str(), ss2.str()); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, istream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + std::stringstream ss1; + ss1 << get_rand() << ", " << get_rand(); + std::stringstream ss2; + ss2 << ss1.str(); + type v1, v2; + ss1 >> v1; + ss1.ignore((std::numeric_limits::max)(), ','); + ss1 >> v2; + dxle::point_c v; + ss2 >> v; + IUTEST_ASSERT(v == dxle::point_c(v1, v2)); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, wistream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + std::wstringstream ss1; + ss1 << get_rand() << L", " << get_rand(); + std::wstringstream ss2; + ss2 << ss1.str(); + type v1, v2; + ss1 >> v1; + ss1.ignore((std::numeric_limits::max)(), L','); + ss1 >> v2; + dxle::point_c v; + ss2 >> v; + IUTEST_ASSERT(v == dxle::point_c(v1, v2)); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, unary_operaotr_plus) { + using type = TypeParam; + const bool eq1 = 0 == dxle::point_c{} && dxle::point_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const dxle::point_c value1 = { get_rand(), get_rand() }; + const auto value2 = +value1; + IUTEST_ASSERT(value1 == value2); + } +} +namespace detail { + template::value> + struct basic_types_point2d_unary_operaotr_minus_helper { + using type = T; + void operator()() {} + }; + template + struct basic_types_point2d_unary_operaotr_minus_helper { + using type = T; + void operator()() { + const bool eq1 = 0 == dxle::point_c{} && dxle::point_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + + const dxle::point_c value1 = { x, y }; + const auto value2 = -value1; + IUTEST_ASSERT(value2 == dxle::point_c(-x, -y)); + } + } + }; +} +IUTEST_TYPED_TEST(basic_types_point2d, unary_operaotr_minus) { + detail::basic_types_point2d_unary_operaotr_minus_helper{}(); +} +IUTEST_TYPED_TEST(basic_types_point2d, operator_add) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::min() + 2, lim::max() - 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + const dxle::point_c value1 = { value1_x, value1_y }; + const auto first_add_dist = get_rand_for_add(value1_x, value1_y, 1); + auto value2 = value1 + dxle::point_c{first_add_dist, first_add_dist}; + IUTEST_ASSERT(value2.x == value1_x + first_add_dist); + IUTEST_ASSERT(value2.y == value1_y + first_add_dist); + const auto second_add_dist = get_rand_for_add(value2.x, value2.y, 0); + value2 += dxle::point_c{second_add_dist, second_add_dist}; + IUTEST_ASSERT(value2.x == value1_x + first_add_dist + second_add_dist); + IUTEST_ASSERT(value2.y == value1_y + first_add_dist + second_add_dist); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, operator_sub) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::min() + 2, lim::max() - 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + const dxle::point_c value1 = { value1_x, value1_y }; + const auto first_sub_dist = get_rand_for_sub(value1_x, value1_y, 1); + auto value2 = value1 - dxle::point_c{first_sub_dist, first_sub_dist}; + IUTEST_ASSERT(value2.x == value1_x - first_sub_dist); + IUTEST_ASSERT(value2.y == value1_y - first_sub_dist); + const auto second_sub_dist = get_rand_for_sub(value2.x, value2.y, 0); + value2 -= dxle::point_c{second_sub_dist, second_sub_dist}; + IUTEST_ASSERT(value2.x == value1_x - first_sub_dist - second_sub_dist); + IUTEST_ASSERT(value2.y == value1_y - first_sub_dist - second_sub_dist); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, operator_mul) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(inferior_sqrt2(lim::min()), inferior_sqrt(lim::max())); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + dxle::point_c value1 = { value1_x, value1_y }; + const auto first_mul_num = get_rand(); + auto value2 = value1 * first_mul_num; + IUTEST_ASSERT(value2.x == value1_x * first_mul_num); + IUTEST_ASSERT(value2.y == value1_y * first_mul_num); + auto value3 = first_mul_num * value1; + IUTEST_ASSERT(value2 == value3); + value1 *= first_mul_num; + IUTEST_ASSERT(value3 == value1); + } +} +IUTEST_TYPED_TEST(basic_types_point2d, operator_div) { + using type = TypeParam; + using lim = std::numeric_limits; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand_for_div1(lim::min(), lim::max()); + const auto value1_y = get_rand_for_div1(lim::min(), lim::max()); + dxle::point_c value1 = { value1_x, value1_y }; + const auto first_div_num = get_rand_for_div2(value1_x, value1_y); + auto value2 = value1 / first_div_num; + IUTEST_ASSERT(value2.x == value1_x / first_div_num); + IUTEST_ASSERT(value2.y == value1_y / first_div_num); + value1 /= first_div_num; + IUTEST_ASSERT(value2 == value1); + } +} +namespace detail { + template::value> + struct basic_types_point2d_abs_helper { + using type = T; + using lim = std::numeric_limits; + type operator()() { return lim::max(); } + }; + template + struct basic_types_point2d_abs_helper { + using type = T; + using lim = std::numeric_limits; + type operator()() { return -1; } + }; +} +IUTEST_TYPED_TEST(basic_types_point2d, abs) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::lowest(), detail::basic_types_point2d_abs_helper()()); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + dxle::point_c value1 = { value1_x, value1_y }; + IUTEST_ASSERT(dxle::point_c(dxle::abs(value1_x), dxle::abs(value1_y)) == dxle::abs(value1)); + } +} +namespace detail { + template::value> + struct basic_types_point2d_dot_helper { + using type = T; + void operator()() {} + }; + template + struct basic_types_point2d_dot_helper { + using type = T; + void operator()() + { + const dxle::point_c a = { 2, 1 }; + const dxle::point_c b = { 1, 1 }; + IUTEST_ASSERT(type(-4) == (dxle::dot((-2 * a + 3 * b), (4 * a - 7 * b)))); + } + }; + +} +IUTEST_TYPED_TEST(basic_types_point2d, dot_product) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(inferior_sqrt2(lim::min()) / 2, inferior_sqrt(lim::max()) / 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const dxle::point_c value1 = { get_rand(), get_rand() }; + const dxle::point_c value2 = { get_rand(), get_rand() }; + const auto re1 = dxle::dot(value1, value2); + const auto re2 = value1.x * value2.x + value1.y * value2.y; + IUTEST_ASSERT(re1 == re2); + } + detail::basic_types_point2d_dot_helper{}(); + const dxle::point_c ex = { 1, 0 }; + const dxle::point_c ey = { 0, 1 }; + IUTEST_ASSERT_EQ(type(0), dxle::dot(ex, ey)); + IUTEST_ASSERT_EQ(type(1), dxle::dot(ex, ex)); + IUTEST_ASSERT_EQ(type(1), dxle::dot(ey, ey)); +} +IUTEST_TYPED_TEST(basic_types_point2d, distance) { + using type = TypeParam; + const dxle::point_c zero = {}; + const dxle::point_c a = { 3, 4 }; + IUTEST_ASSERT(type(5) == dxle::distance(zero, a)); + const dxle::point_c ex = { 1, 0 }; + IUTEST_ASSERT(type(1) == dxle::distance(zero, ex)); + const dxle::point_c ey = { 0, 1 }; + IUTEST_ASSERT(type(1) == dxle::distance(zero, ey)); +} diff --git a/tests/no_dxlib/basic_types/point3d.hpp b/tests/no_dxlib/basic_types/point3d.hpp new file mode 100644 index 0000000..77d5892 --- /dev/null +++ b/tests/no_dxlib/basic_types/point3d.hpp @@ -0,0 +1,392 @@ +/*============================================================================= + Copyright (C) 2015-2017 DxLibEx project + https://github.com/Nagarei/DxLibEx/ + + Distributed under the Boost Software License, Version 1.0. + (See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#include <3rd_party/iutest/include/iutest.hpp> +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) && !defined(__c2__) +# pragma warning(disable: 4189) +#endif +template +struct basic_types_point3d : public ::iutest::Test{}; +IUTEST_TYPED_TEST_CASE(basic_types_point3d, ::iutest::Types); +IUTEST_TYPED_TEST(basic_types_point3d, construct) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value_x = get_rand(); + const auto value_y = get_rand(); + const auto value_z = get_rand(); + const dxle::point3d_c value = { value_x, value_y, value_z }; + IUTEST_ASSERT(value.x == value_x); + IUTEST_ASSERT(value.y == value_y); + IUTEST_ASSERT(value.z == value_z); + } + const dxle::point3d_c value1 = {}; + const auto value2 = value1; + const auto value3 = std::move(value1); + IUTEST_ASSERT(is_l_zero(value1.x, value1.y, value1.z, value2.x, value2.y, value2.z, value3.x, value3.y, value3.z)); + const dxle::point3d_c value4 = { 2, 12, 22 }; + IUTEST_ASSERT(value4.x == static_cast(2)); + IUTEST_ASSERT(value4.y == static_cast(12)); + IUTEST_ASSERT(value4.z == static_cast(22)); +} +IUTEST_TYPED_TEST(basic_types_point3d, factory) { + using type = TypeParam; + const std::tuple pa = { static_cast(12), static_cast(23), static_cast(34) }; + const auto po = dxle::make_point3d_c(pa); + static_assert(std::is_same::value, "err"); + IUTEST_ASSERT(po.x == std::get<0>(pa)); + IUTEST_ASSERT(po.y == std::get<1>(pa)); + IUTEST_ASSERT(po.z == std::get<2>(pa)); + const auto po2 = dxle::make_point3d_c(std::tuple(pa)); + IUTEST_ASSERT(po2.x == std::get<0>(pa)); + IUTEST_ASSERT(po2.y == std::get<1>(pa)); + IUTEST_ASSERT(po2.z == std::get<2>(pa)); +} +IUTEST_TYPED_TEST(basic_types_point3d, operaotr_eq) { + using type = TypeParam; + const bool eq1 = 0 == dxle::point3d_c{}; + const bool eq2 = dxle::point3d_c{} == 0; + IUTEST_ASSERT(eq1); + IUTEST_ASSERT(eq2); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value_x = get_rand(); + const auto value_y = get_rand(); + const auto value_z = get_rand(); + const dxle::point3d_c value = { value_x, value_y, value_z }; + IUTEST_ASSERT(value == dxle::point3d_c(value_x, value_y, value_z)); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, ostream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + const auto z = get_rand(); + std::stringstream ss1; + ss1 << x << ", " << y << ", " << z; + const dxle::point3d_c value = { x, y, z }; + std::stringstream ss2; + ss2 << value; + IUTEST_ASSERT_EQ(ss1.str(), ss2.str()); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, wostream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + const auto z = get_rand(); + std::wstringstream ss1; + ss1 << x << L", " << y << L", " << z; + const dxle::point3d_c value = { x, y, z }; + std::wstringstream ss2; + ss2 << value; + IUTEST_ASSERT_EQ(ss1.str(), ss2.str()); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, istream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + std::stringstream ss1; + ss1 << get_rand() << ", " << get_rand() << ", " << get_rand(); + std::stringstream ss2; + ss2 << ss1.str(); + type v1, v2, v3; + ss1 >> v1; + ss1.ignore((std::numeric_limits::max)(), ','); + ss1 >> v2; + ss1.ignore((std::numeric_limits::max)(), ','); + ss1 >> v3; + dxle::point3d_c v; + ss2 >> v; + IUTEST_ASSERT(v == dxle::point3d_c(v1, v2, v3)); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, wistream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + std::wstringstream ss1; + ss1 << get_rand() << L", " << get_rand() << L", " << get_rand(); + std::wstringstream ss2; + ss2 << ss1.str(); + type v1, v2, v3; + ss1 >> v1; + ss1.ignore((std::numeric_limits::max)(), L','); + ss1 >> v2; + ss1.ignore((std::numeric_limits::max)(), L','); + ss1 >> v3; + dxle::point3d_c v; + ss2 >> v; + IUTEST_ASSERT(v == dxle::point3d_c(v1, v2, v3)); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, unary_operaotr_plus) { + using type = TypeParam; + const bool eq1 = 0 == dxle::point3d_c{} && dxle::point3d_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const dxle::point3d_c value1 = { get_rand(), get_rand(), get_rand() }; + const auto value2 = +value1; + IUTEST_ASSERT(value1 == value2); + } +} +namespace detail { + template::value> + struct basic_types_point3d_unary_operaotr_minus_helper { + using type = T; + void operator()() {} + }; + template + struct basic_types_point3d_unary_operaotr_minus_helper { + using type = T; + void operator()() { + const bool eq1 = 0 == dxle::point3d_c{} && dxle::point3d_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + const auto z = get_rand(); + + const dxle::point3d_c value1 = { x, y, z }; + const auto value2 = -value1; + IUTEST_ASSERT(value2 == dxle::point3d_c(-x, -y, -z)); + } + } + }; +} +IUTEST_TYPED_TEST(basic_types_point3d, unary_operaotr_minus) { + detail::basic_types_point3d_unary_operaotr_minus_helper{}(); +} +IUTEST_TYPED_TEST(basic_types_point3d, operator_add) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::min() + 2, lim::max() - 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + const auto value1_z = get_rand(); + const dxle::point3d_c value1 = { value1_x, value1_y, value1_z }; + const auto first_add_dist = get_rand_for_add(value1_x, value1_y, value1_z, 1); + auto value2 = value1 + dxle::point3d_c{first_add_dist, first_add_dist, first_add_dist }; + IUTEST_ASSERT(value2.x == value1_x + first_add_dist); + IUTEST_ASSERT(value2.y == value1_y + first_add_dist); + IUTEST_ASSERT(value2.z == value1_z + first_add_dist); + const auto second_add_dist = get_rand_for_add(value2.x, value2.y, value2.z, 0); + value2 += dxle::point3d_c{second_add_dist, second_add_dist, second_add_dist}; + IUTEST_ASSERT(value2.x == value1_x + first_add_dist + second_add_dist); + IUTEST_ASSERT(value2.y == value1_y + first_add_dist + second_add_dist); + IUTEST_ASSERT(value2.z == value1_z + first_add_dist + second_add_dist); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, operator_sub) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::min() + 2, lim::max() - 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + const auto value1_z = get_rand(); + const dxle::point3d_c value1 = { value1_x, value1_y, value1_z }; + const auto first_add_dist = get_rand_for_sub(value1_x, value1_y, value1_z, 1); + auto value2 = value1 - dxle::point3d_c{first_add_dist, first_add_dist, first_add_dist }; + IUTEST_ASSERT(value2.x == value1_x - first_add_dist); + IUTEST_ASSERT(value2.y == value1_y - first_add_dist); + IUTEST_ASSERT(value2.z == value1_z - first_add_dist); + const auto second_add_dist = get_rand_for_sub(value2.x, value2.y, value2.z, 0); + value2 -= dxle::point3d_c{second_add_dist, second_add_dist, second_add_dist}; + IUTEST_ASSERT(value2.x == value1_x - first_add_dist - second_add_dist); + IUTEST_ASSERT(value2.y == value1_y - first_add_dist - second_add_dist); + IUTEST_ASSERT(value2.z == value1_z - first_add_dist - second_add_dist); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, operator_mul) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(inferior_sqrt2(lim::min()), inferior_sqrt(lim::max())); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + const auto value1_z = get_rand(); + dxle::point3d_c value1 = { value1_x, value1_y, value1_z }; + const auto first_mul_num = get_rand(); + auto value2 = value1 * first_mul_num; + IUTEST_ASSERT(value2.x == value1_x * first_mul_num); + IUTEST_ASSERT(value2.y == value1_y * first_mul_num); + IUTEST_ASSERT(value2.z == value1_z * first_mul_num); + auto value3 = first_mul_num * value1; + IUTEST_ASSERT(value2 == value3); + value1 *= first_mul_num; + IUTEST_ASSERT(value3 == value1); + } +} +IUTEST_TYPED_TEST(basic_types_point3d, operator_div) { + using type = TypeParam; + using lim = std::numeric_limits; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand_for_div1(lim::min(), lim::max()); + const auto value1_y = get_rand_for_div1(lim::min(), lim::max()); + const auto value1_z = get_rand_for_div1(lim::min(), lim::max()); + dxle::point3d_c value1 = { value1_x, value1_y, value1_z }; + const auto first_div_num = get_rand_for_div2(value1_x, value1_y, value1_z); + auto value2 = value1 / first_div_num; + IUTEST_ASSERT(value2.x == value1_x / first_div_num); + IUTEST_ASSERT(value2.y == value1_y / first_div_num); + IUTEST_ASSERT(value2.z == value1_z / first_div_num); + value1 /= first_div_num; + IUTEST_ASSERT(value2 == value1); + } +} +namespace detail { + template::value> + struct basic_types_point3d_abs_helper { + using type = T; + using lim = std::numeric_limits; + type operator()() { return lim::max(); } + }; + template + struct basic_types_point3d_abs_helper { + using type = T; + using lim = std::numeric_limits; + type operator()() { return -1; } + }; +} +IUTEST_TYPED_TEST(basic_types_point3d, abs) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::lowest(), detail::basic_types_point3d_abs_helper()()); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_x = get_rand(); + const auto value1_y = get_rand(); + const auto value1_z = get_rand(); + dxle::point3d_c value1 = { value1_x, value1_y, value1_z }; + IUTEST_ASSERT(dxle::point3d_c(dxle::abs(value1_x), dxle::abs(value1_y), dxle::abs(value1_z)) == dxle::abs(value1)); + } +} +namespace detail { + template::value> + struct basic_types_point3d_dot_helper { + using type = T; + void operator()() {} + }; + template + struct basic_types_point3d_dot_helper { + using type = T; + void operator()() + { + const dxle::point3d_c a = { -3, 1, 2 }; + const dxle::point3d_c b = { -2, 3, 1 }; + const dxle::point3d_c c = { -1, 2, 3 }; + IUTEST_ASSERT(type(3) == (dxle::dot(b - a, c- a))); + } + }; +} +IUTEST_TYPED_TEST(basic_types_point3d, dot_product) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(inferior_sqrt2(lim::min()) / 2, inferior_sqrt(lim::max()) / 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const dxle::point3d_c value1 = { get_rand(), get_rand(), get_rand() }; + const dxle::point3d_c value2 = { get_rand(), get_rand(), get_rand() }; + const auto re1 = dxle::dot(value1, value2); + const auto re2 = value1.x * value2.x + value1.y * value2.y + value1.z * value2.z; + IUTEST_ASSERT(re1 == re2); + } + detail::basic_types_point3d_dot_helper{}(); + const dxle::point3d_c ex = { 1, 0, 0 }; + const dxle::point3d_c ey = { 0, 1, 0 }; + const dxle::point3d_c ez = { 0, 0, 1 }; + IUTEST_ASSERT_EQ(type(0), dxle::dot(ex, ey)); + IUTEST_ASSERT_EQ(type(0), dxle::dot(ey, ez)); + IUTEST_ASSERT_EQ(type(0), dxle::dot(ez, ex)); + IUTEST_ASSERT_EQ(type(1), dxle::dot(ex, ex)); + IUTEST_ASSERT_EQ(type(1), dxle::dot(ey, ey)); + IUTEST_ASSERT_EQ(type(1), dxle::dot(ez, ez)); +} +namespace detail { + template::value> + struct basic_types_point3d_cross_helper { + using type = T; + void operator()() {} + }; + template + struct basic_types_point3d_cross_helper { + using type = T; + void operator()() + { + static const std::array, 3> check_list[] = { + {{ { 1, 3, 2 }, { -1, 1, 2 }, { 4, -4, 4 } }}, + {{ { 1, 1, 2 }, { 3, 6, 9 }, { -3, -3, 3 } }}, + {{ { 6, 3, 3 }, { -7, -3, 10 }, { 39, -81, 3 } }}, + {{ { 0, -1, 2 }, { -1, 0, 5 }, { -5, -2, -1 } }} + }; + for (auto&& i : check_list) { + IUTEST_ASSERT(i[2] == (dxle::cross(i[0], i[1]))); + } + } + }; +} +IUTEST_TYPED_TEST(basic_types_point3d, cross_product) { + using type = TypeParam; + detail::basic_types_point3d_cross_helper{}(); + const dxle::point3d_c ex = { 1, 0, 0 }; + const dxle::point3d_c ey = { 0, 1, 0 }; + const dxle::point3d_c ez = { 0, 0, 1 }; + IUTEST_ASSERT_EQ(ez, dxle::cross(ex, ey)); + IUTEST_ASSERT_EQ(ex, dxle::cross(ey, ez)); + IUTEST_ASSERT_EQ(ey, dxle::cross(ez, ex)); + IUTEST_ASSERT((0 == dxle::cross(ex, ex))); + IUTEST_ASSERT((0 == dxle::cross(ey, ey))); + IUTEST_ASSERT((0 == dxle::cross(ez, ez))); +} +IUTEST_TYPED_TEST(basic_types_point3d, distance) { + using type = TypeParam; + const dxle::point3d_c zero = {}; + const dxle::point3d_c a = { 12, 15, 16 }; + IUTEST_ASSERT(type(25) == dxle::distance(zero, a)); + static const dxle::point3d_c b[] = { { 3, 4, 0 }, { 0, 3, 4 }, { 4, 0, 3 } }; + for (auto&& i : b) { + IUTEST_ASSERT(type(5) == dxle::distance(zero, i)); + } + const dxle::point3d_c ex = { 1, 0, 0 }; + IUTEST_ASSERT(type(1) == dxle::distance(zero, ex)); + const dxle::point3d_c ey = { 0, 1, 0 }; + IUTEST_ASSERT(type(1) == dxle::distance(zero, ey)); + const dxle::point3d_c ez = { 0, 0, 1 }; + IUTEST_ASSERT(type(1) == dxle::distance(zero, ez)); +} diff --git a/tests/no_dxlib/basic_types/size.hpp b/tests/no_dxlib/basic_types/size.hpp new file mode 100644 index 0000000..0e0c7de --- /dev/null +++ b/tests/no_dxlib/basic_types/size.hpp @@ -0,0 +1,272 @@ +/*============================================================================= + Copyright (C) 2015-2017 DxLibEx project + https://github.com/Nagarei/DxLibEx/ + + Distributed under the Boost Software License, Version 1.0. + (See http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#include <3rd_party/iutest/include/iutest.hpp> +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) && !defined(__c2__) +# pragma warning(disable: 4189) +#endif +template +struct basic_types_size : public ::iutest::Test{}; +IUTEST_TYPED_TEST_CASE(basic_types_size, ::iutest::Types); +IUTEST_TYPED_TEST(basic_types_size, construct) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value_width = get_rand(); + const auto value_height = get_rand(); + const dxle::size_c value = { value_width, value_height }; + IUTEST_ASSERT(value.width == value_width); + IUTEST_ASSERT(value.height == value_height); + } + const dxle::size_c value1 = {}; + const auto value2 = value1; + const auto value3 = std::move(value1); + IUTEST_ASSERT(is_l_zero(value1.width, value1.height, value2.width, value2.height, value3.width, value3.height)); + const dxle::size_c value4 = { 2, 12 }; + IUTEST_ASSERT(value4.width == static_cast(2)); + IUTEST_ASSERT(value4.height == static_cast(12)); +} +IUTEST_TYPED_TEST(basic_types_size, factory) { + using type = TypeParam; + const std::pair pa = { static_cast(12), static_cast(23) }; + const auto po = dxle::make_size_c(pa); + static_assert(std::is_same::value, "err"); + IUTEST_ASSERT(po.width == pa.first); + IUTEST_ASSERT(po.height == pa.second); + const auto po2 = dxle::make_size_c(std::pair(pa)); + IUTEST_ASSERT(po2.width == pa.first); + IUTEST_ASSERT(po2.height == pa.second); +} +IUTEST_TYPED_TEST(basic_types_size, operaotr_eq) { + using type = TypeParam; + const bool eq1 = 0 == dxle::size_c{} && dxle::size_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value_width = get_rand(); + const auto value_height = get_rand(); + const dxle::size_c value = { value_width, value_height }; + IUTEST_ASSERT(value == dxle::size_c(value_width, value_height)); + } +} +IUTEST_TYPED_TEST(basic_types_size, ostream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + std::stringstream ss1; + ss1 << x << ", " << y; + const dxle::size_c value = { x, y }; + std::stringstream ss2; + ss2 << value; + IUTEST_ASSERT_EQ(ss1.str(), ss2.str()); + } +} +IUTEST_TYPED_TEST(basic_types_size, wostream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + std::wstringstream ss1; + ss1 << x << L", " << y; + const dxle::size_c value = { x, y }; + std::wstringstream ss2; + ss2 << value; + IUTEST_ASSERT_EQ(ss1.str(), ss2.str()); + } +} +IUTEST_TYPED_TEST(basic_types_size, istream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + std::stringstream ss1; + ss1 << get_rand() << ", " << get_rand(); + std::stringstream ss2; + ss2 << ss1.str(); + type v1, v2; + ss1 >> v1; + ss1.ignore((std::numeric_limits::max)(), ','); + ss1 >> v2; + dxle::size_c v; + ss2 >> v; + IUTEST_ASSERT(v == dxle::size_c(v1, v2)); + } +} +IUTEST_TYPED_TEST(basic_types_size, wistream_operator) { + using type = TypeParam; + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + std::wstringstream ss1; + ss1 << get_rand() << L", " << get_rand(); + std::wstringstream ss2; + ss2 << ss1.str(); + type v1, v2; + ss1 >> v1; + ss1.ignore((std::numeric_limits::max)(), L','); + ss1 >> v2; + dxle::size_c v; + ss2 >> v; + IUTEST_ASSERT(v == dxle::size_c(v1, v2)); + } +} +IUTEST_TYPED_TEST(basic_types_size, unary_operaotr_plus) { + using type = TypeParam; + const bool eq1 = 0 == dxle::size_c{} && dxle::size_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const dxle::size_c value1 = { get_rand(), get_rand() }; + const auto value2 = +value1; + IUTEST_ASSERT(value1 == value2); + } +} +namespace detail { + template::value> + struct basic_types_size_unary_operaotr_minus_helper { + using type = T; + void operator()() {} + }; + template + struct basic_types_size_unary_operaotr_minus_helper { + using type = T; + void operator()() { + const bool eq1 = 0 == dxle::size_c{} && dxle::size_c{} == 0; + IUTEST_ASSERT(eq1); + dxle::uniform_normal_distribution dist; + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto x = get_rand(); + const auto y = get_rand(); + + const dxle::size_c value1 = { x, y }; + const auto value2 = -value1; + IUTEST_ASSERT(value2 == dxle::size_c(-x, -y)); + } + } + }; +} +IUTEST_TYPED_TEST(basic_types_size, unary_operaotr_minus) { + detail::basic_types_size_unary_operaotr_minus_helper{}(); +} +IUTEST_TYPED_TEST(basic_types_size, operator_add) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::min() + 2, lim::max() - 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_width = get_rand(); + const auto value1_height = get_rand(); + const dxle::size_c value1 = { value1_width, value1_height }; + const auto first_add_dist = get_rand_for_add(value1_width, value1_height, 1); + auto value2 = value1 + dxle::size_c{first_add_dist, first_add_dist}; + IUTEST_ASSERT(value2.width == value1_width + first_add_dist); + IUTEST_ASSERT(value2.height == value1_height + first_add_dist); + const auto second_add_dist = get_rand_for_add(value2.width, value2.height, 0); + value2 += dxle::size_c{second_add_dist, second_add_dist}; + IUTEST_ASSERT(value2.width == value1_width + first_add_dist + second_add_dist); + IUTEST_ASSERT(value2.height == value1_height + first_add_dist + second_add_dist); + } +} +IUTEST_TYPED_TEST(basic_types_size, operator_sub) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::min() + 2, lim::max() - 2); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_width = get_rand(); + const auto value1_height = get_rand(); + const dxle::size_c value1 = { value1_width, value1_height }; + const auto first_sub_dist = get_rand_for_sub(value1_width, value1_height, 1); + auto value2 = value1 - dxle::size_c{first_sub_dist, first_sub_dist}; + IUTEST_ASSERT(value2.width == value1_width - first_sub_dist); + IUTEST_ASSERT(value2.height == value1_height - first_sub_dist); + const auto second_sub_dist = get_rand_for_sub(value2.width, value2.height, 0); + value2 -= dxle::size_c{second_sub_dist, second_sub_dist}; + IUTEST_ASSERT(value2.width == value1_width - first_sub_dist - second_sub_dist); + IUTEST_ASSERT(value2.height == value1_height - first_sub_dist - second_sub_dist); + } +} +IUTEST_TYPED_TEST(basic_types_size, operator_mul) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(inferior_sqrt2(lim::min()), inferior_sqrt(lim::max())); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_width = get_rand(); + const auto value1_height = get_rand(); + dxle::size_c value1 = { value1_width, value1_height }; + const auto first_mul_num = get_rand(); + auto value2 = value1 * first_mul_num; + IUTEST_ASSERT(value2.width == value1_width * first_mul_num); + IUTEST_ASSERT(value2.height == value1_height * first_mul_num); + auto value3 = first_mul_num * value1; + IUTEST_ASSERT(value2 == value3); + value1 *= first_mul_num; + IUTEST_ASSERT(value3 == value1); + } +} +IUTEST_TYPED_TEST(basic_types_size, operator_div) { + using type = TypeParam; + using lim = std::numeric_limits; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_width = get_rand_for_div1(lim::min(), lim::max()); + const auto value1_height = get_rand_for_div1(lim::min(), lim::max()); + dxle::size_c value1 = { value1_width, value1_height }; + const auto first_div_num = get_rand_for_div2(value1_width, value1_height); + auto value2 = value1 / first_div_num; + IUTEST_ASSERT(value2.width == value1_width / first_div_num); + IUTEST_ASSERT(value2.height == value1_height / first_div_num); + value1 /= first_div_num; + IUTEST_ASSERT(value2 == value1); + } +} +namespace detail { + template::value> + struct basic_types_size_abs_helper { + using type = T; + using lim = std::numeric_limits; + type operator()() { return lim::max(); } + }; + template + struct basic_types_size_abs_helper { + using type = T; + using lim = std::numeric_limits; + type operator()() { return -1; } + }; +} +IUTEST_TYPED_TEST(basic_types_size, abs) { + using type = TypeParam; + using lim = std::numeric_limits; + dxle::uniform_normal_distribution dist(lim::lowest(), detail::basic_types_size_abs_helper()()); + auto get_rand = [&dist]() { return dist(engine); }; + for (DXLE_UNUSED auto i : dxle::rep(10)) { + const auto value1_width = get_rand(); + const auto value1_height = get_rand(); + dxle::size_c value1 = { value1_width, value1_height }; + IUTEST_ASSERT(dxle::size_c(dxle::abs(value1_width), dxle::abs(value1_height)) == dxle::abs(value1)); + } +} diff --git a/tests/no_dxlib/basic_types_2d.hpp b/tests/no_dxlib/basic_types_2d.hpp deleted file mode 100644 index aaf3982..0000000 --- a/tests/no_dxlib/basic_types_2d.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (C) 2015-2017 DxLibEx project - https://github.com/Nagarei/DxLibEx/ - - Distributed under the Boost Software License, Version 1.0. - (See http://www.boost.org/LICENSE_1_0.txt) -=============================================================================*/ -#include -#include -#define BOOST_TEST_MODULE basic_types_2d -#define BOOST_TEST_NO_LIB -#include "boost/test/included/unit_test.hpp" -#include - - -BOOST_AUTO_TEST_CASE(opertor_plus_minus_test) -{ - - auto seed = std::random_device{}(); - std::mt19937 engine(seed); - std::uniform_int_distribution<> dist(INT_MIN, INT_MAX); - auto get_rand = [&engine, &dist](){ return dist(engine); }; - - for (size_t i = 0; i < 10000; ++i) - { - int value_x = get_rand(); - int value_y = get_rand(); - - dxle::pointi point1{ value_x, value_y }; - - BOOST_CHECK_EQUAL(point1.x, value_x); - BOOST_CHECK_EQUAL(point1.y, value_y); - - dxle::pointi point2(3, 2); - dxle::pointi point3 = point1 + point2; - BOOST_CHECK_EQUAL(point3.x, value_x + 3); - BOOST_CHECK_EQUAL(point3.y, value_y + 2); - - auto point4 = point1 - point2; - BOOST_CHECK_EQUAL(point4.x, value_x - 3); - BOOST_CHECK_EQUAL(point4.y, value_y - 2); - - point1 += point2; - BOOST_CHECK_EQUAL(point1.x, value_x + 3); - BOOST_CHECK_EQUAL(point1.y, value_y + 2); - - point1 -= point2; - BOOST_CHECK_EQUAL(point1.x, value_x); - BOOST_CHECK_EQUAL(point1.y, value_y); - - } - - -} \ No newline at end of file diff --git a/tests/no_dxlib/no_dxlib.vcxproj b/tests/no_dxlib/no_dxlib.vcxproj index 819e0ca..b94b4d3 100644 --- a/tests/no_dxlib/no_dxlib.vcxproj +++ b/tests/no_dxlib/no_dxlib.vcxproj @@ -1,6 +1,22 @@  + + clang_Debug + Win32 + + + clang_Debug + x64 + + + clang_Release + Win32 + + + clang_Release + x64 + Debug Win32 @@ -22,6 +38,7 @@ {44682BAF-4F62-42D9-90EB-D7F46CD21B95} Win32Proj no_dxlib + 8.1 @@ -83,7 +100,7 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\;$(BOOST_ROOT); + ..\..\; MultiThreadedDebug 4702 @@ -101,9 +118,9 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\;$(BOOST_ROOT); + ..\..\; MultiThreadedDebug - 4702 + 4189;5030 Console @@ -121,7 +138,7 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\;$(BOOST_ROOT);%(AdditionalIncludeDirectories) + ..\..\; MultiThreaded 4702 @@ -143,9 +160,9 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\;$(BOOST_ROOT);%(AdditionalIncludeDirectories) + ..\..\; MultiThreaded - 4702 + 4189;5030 Console @@ -155,11 +172,47 @@ ..\..\; + + + ..\..\; + Disabled + FullDebug + true + -Wextra %(AdditionalOptions) + + + + + ..\..\; + Disabled + FullDebug + true + -Wextra %(AdditionalOptions) + + + + + ..\..\; + true + -Wextra %(AdditionalOptions) + MaxSpeed + + + + + ..\..\; + true + -Wextra %(AdditionalOptions) + MaxSpeed + + - + + + diff --git a/tests/no_dxlib/no_dxlib.vcxproj.filters b/tests/no_dxlib/no_dxlib.vcxproj.filters index b06d303..6703d62 100644 --- a/tests/no_dxlib/no_dxlib.vcxproj.filters +++ b/tests/no_dxlib/no_dxlib.vcxproj.filters @@ -12,7 +12,13 @@ - + + ソース ファイル + + + ソース ファイル + + ソース ファイル diff --git a/tests/no_dxlib/no_dxlib_test.cpp b/tests/no_dxlib/no_dxlib_test.cpp index eb547ca..7f4bcbb 100644 --- a/tests/no_dxlib/no_dxlib_test.cpp +++ b/tests/no_dxlib/no_dxlib_test.cpp @@ -5,4 +5,13 @@ Copyright (C) 2015-2017 DxLibEx project Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ -#include "basic_types_2d.hpp" +#include "../../3rd_party/iutest/include/iutest.hpp" +#include "basic_types/point2d.hpp" +#include "basic_types/point3d.hpp" +#include "basic_types/size.hpp" +std::mt19937 engine = dxle::create_engine(); +int main(int argc, char** argv) +{ + IUTEST_INIT(&argc, argv); + return IUTEST_RUN_ALL_TESTS(); +} diff --git a/tests/with_dxLib/with_dxLib.vcxproj b/tests/with_dxLib/with_dxLib.vcxproj index ad6e9e0..72cf9d4 100644 --- a/tests/with_dxLib/with_dxLib.vcxproj +++ b/tests/with_dxLib/with_dxLib.vcxproj @@ -1,6 +1,22 @@  + + clang_Debug + Win32 + + + clang_Debug + x64 + + + clang_Release + Win32 + + + clang_Release + x64 + Debug Win32 @@ -22,6 +38,7 @@ {280349E1-6523-4483-97DB-2D16B0716396} Win32Proj with_dxLib + 8.1 @@ -119,7 +136,7 @@ true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true - ..\..\;$(DXLIB_ROOT);%(AdditionalIncludeDirectories) + ..\..\;$(DXLIB_ROOT); MultiThreaded @@ -140,7 +157,7 @@ true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true - ..\..\;$(DXLIB_ROOT);%(AdditionalIncludeDirectories) + ..\..\;$(DXLIB_ROOT); MultiThreaded @@ -151,6 +168,44 @@ ..\..\;$(DXLIB_ROOT); + + + ..\..\;$(DXLIB_ROOT); + FullDebug + Disabled + true + -Wextra %(AdditionalOptions) + MultiThreadedDebug + + + + + ..\..\;$(DXLIB_ROOT); + MaxSpeed + true + -Wextra %(AdditionalOptions) + MultiThreaded + + + + + ..\..\;$(DXLIB_ROOT); + FullDebug + Disabled + true + -Wextra %(AdditionalOptions) + MultiThreadedDebug + + + + + ..\..\;$(DXLIB_ROOT); + MaxSpeed + true + -Wextra %(AdditionalOptions) + MultiThreaded + + diff --git a/tests/with_dxLib/with_dxLib.vcxproj.filters b/tests/with_dxLib/with_dxLib.vcxproj.filters index 5924fa6..ff69490 100644 --- a/tests/with_dxLib/with_dxLib.vcxproj.filters +++ b/tests/with_dxLib/with_dxLib.vcxproj.filters @@ -12,8 +12,6 @@ - - ソース ファイル - + \ No newline at end of file diff --git a/tests/with_dxLib/with_dxLib_test.cpp b/tests/with_dxLib/with_dxLib_test.cpp index bb6576d..dbc4f75 100644 --- a/tests/with_dxLib/with_dxLib_test.cpp +++ b/tests/with_dxLib/with_dxLib_test.cpp @@ -1 +1 @@ -#include "GraphTest.hpp" \ No newline at end of file +#include "graph.hpp"