This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #607 from senior-zero/enh-main/github/sort_128
Support __{u,}int128_t in radix sort
- Loading branch information
Showing
7 changed files
with
200 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "test_util.h" | ||
|
||
#include "catch2_test_helper.h" | ||
|
||
template <typename T> | ||
std::string print(T val) | ||
{ | ||
std::stringstream ss; | ||
ss << val; | ||
return ss.str(); | ||
} | ||
|
||
#if CUB_IS_INT128_ENABLED | ||
TEST_CASE("Test utils can print __int128", "[test][utils]") | ||
{ | ||
REQUIRE( print(__int128_t{0}) == "0" ); | ||
REQUIRE( print(__int128_t{42}) == "42" ); | ||
REQUIRE( print(__int128_t{-1}) == "-1" ); | ||
REQUIRE( print(__int128_t{-42}) == "-42" ); | ||
REQUIRE( print(__int128_t{-1} << 120) == "-1329227995784915872903807060280344576" ); | ||
} | ||
|
||
TEST_CASE("Test utils can print __uint128", "[test][utils]") | ||
{ | ||
REQUIRE( print(__uint128_t{0}) == "0" ); | ||
REQUIRE( print(__uint128_t{1}) == "1" ); | ||
REQUIRE( print(__uint128_t{42}) == "42" ); | ||
REQUIRE( print(__uint128_t{1} << 120) == "1329227995784915872903807060280344576" ); | ||
} | ||
#endif | ||
|
||
TEST_CASE("Test utils can print KeyValuePair", "[test][utils]") | ||
{ | ||
REQUIRE( print(cub::KeyValuePair<int, int>{42, -42}) == "(42,-42)" ); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters