Skip to content

Commit

Permalink
Update dependencies and CNL function calls (hbe72#9)
Browse files Browse the repository at this point in the history
* Replace calls to cnl::convert function object
* Update CNL Git tag to compatible commit of develop branch
* Update GoogleTest to latest
  • Loading branch information
johnmcfarlane authored and hbe72 committed Apr 15, 2019
1 parent 68fd9b8 commit fbababc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ message("-- INT128 = ${INT128}")
message("-- STD = ${STD}")
message("-- EXCEPTIONS = ${EXCEPTIONS}")

set(CNL_GIT_TAG_DEFAULT 3ce341aeec25204f84d3662cd1abed7f9df015ff)
set(CNL_GIT_TAG_DEFAULT b89764fb4845cc3a5e880e00d0c463520ee3ff92)
set(CNL_GIT_TAG_ENV $ENV{CDSP_CNL_GIT_TAG})
set(CNL_GIT_TAG "" CACHE BOOL "specify which revision of CNL to use")

Expand Down
16 changes: 8 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ endfunction(add_cnl_dependency)
ExternalProject_Add(
GoogleTest
PREFIX ${CMAKE_BINARY_DIR}/GoogleTest
URL "https://github.com/google/googletest/archive/3a4cf1a02ef4adc28fccb7eef2b573b14cd59009.zip"
URL_MD5 "06ac495303fbe94b198026e3c196425e"
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_TAG "39f72ea6f5cd458860b563d7bcb7ea67546e6ea3"
UPDATE_COMMAND ""
INSTALL_COMMAND ""
CMAKE_ARGS -Dgtest_force_shared_crt=ON -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
Expand All @@ -39,16 +39,16 @@ function(add_gtest_dependency target)
ExternalProject_Get_Property(GoogleTest binary_dir)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
target_link_libraries("${target}"
debug ${binary_dir}/googlemock/gtest/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtestd${CMAKE_FIND_LIBRARY_SUFFIXES}
debug ${binary_dir}/googlemock/gtest/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_maind${CMAKE_FIND_LIBRARY_SUFFIXES}
optimized ${binary_dir}/googlemock/gtest/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES}
optimized ${binary_dir}/googlemock/gtest/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_FIND_LIBRARY_SUFFIXES}
debug ${binary_dir}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtestd${CMAKE_FIND_LIBRARY_SUFFIXES}
debug ${binary_dir}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_maind${CMAKE_FIND_LIBRARY_SUFFIXES}
optimized ${binary_dir}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES}
optimized ${binary_dir}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_FIND_LIBRARY_SUFFIXES}
)
else ()
target_link_libraries(
"${target}"
general "${binary_dir}/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a"
general "${binary_dir}/googlemock/gtest/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a"
general "${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a"
general "${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a"
general pthread
)
endif ()
Expand Down
8 changes: 4 additions & 4 deletions test/basic_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@ namespace test_rounding_should_stay_under_64_bits
namespace test_convert_nearest_rounding_elastic_number
{
static constexpr auto a = cnl::elastic_number<8, -4>{0.3125};
static constexpr auto b = cnl::convert<cnl::nearest_rounding_tag, cnl::elastic_number<4, -1>, cnl::elastic_number<8, -4>>{}(a);
static constexpr auto b = cnl::convert<cnl::nearest_rounding_tag, cnl::elastic_number<4, -1>>(a);
static_assert(identical(cnl::elastic_number<4, -1>{0.5}, b),
"cnl::convert<nearest_rounding_tag, elastic_number, elastic_number>");

static constexpr auto c = cnl::convert<cnl::nearest_rounding_tag, cnl::elastic_number<4, -2>, cnl::elastic_number<8, -4>>{}(a);
static constexpr auto c = cnl::convert<cnl::nearest_rounding_tag, cnl::elastic_number<4, -2>>(a);
static_assert(identical(cnl::elastic_number<4, -2>{0.25}, c),
"cnl::convert<nearest_rounding_tag, elastic_number, elastic_number>");
}

namespace test_convert_nearest_rounding_fixed_point
{
static constexpr auto a = cnl::fixed_point<int, -4>{0.3125};
static constexpr auto b = cnl::convert<cnl::nearest_rounding_tag, cnl::fixed_point<int, -1>, cnl::fixed_point<int, -4>>{}(a);
static constexpr auto b = cnl::convert<cnl::nearest_rounding_tag, cnl::fixed_point<int, -1>>(a);
static_assert(identical(cnl::fixed_point<int, -1>{0.5}, b),
"cnl::convert<nearest_rounding_tag, fixed_point, fixed_point>");

static constexpr auto c = cnl::convert<cnl::nearest_rounding_tag, cnl::fixed_point<int, -2>, cnl::fixed_point<int, -4>>{}(a);
static constexpr auto c = cnl::convert<cnl::nearest_rounding_tag, cnl::fixed_point<int, -2>>(a);
static_assert(identical(cnl::fixed_point<int, -2>{0.25}, c),
"cnl::convert<nearest_rounding_tag, fixed_point, fixed_point>");
}

0 comments on commit fbababc

Please sign in to comment.