-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/uuid-fix' into develop
- Loading branch information
Showing
4 changed files
with
50 additions
and
17 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
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,45 @@ | ||
/* | ||
* test_uuid.cc | ||
* | ||
* Created on: Sept 18, 2024 | ||
* Author: N.S. Oblath | ||
*/ | ||
|
||
#include "uuid.hh" | ||
|
||
#include "catch.hpp" | ||
|
||
TEST_CASE( "uuid", "[message]" ) | ||
{ | ||
REQUIRE_NOTHROW( dripline::generate_nil_uuid() ); | ||
REQUIRE_NOTHROW( dripline::generate_random_uuid() ); | ||
|
||
REQUIRE_THROWS_AS( dripline::uuid_from_string( "blah" ), std::runtime_error ); | ||
|
||
std::string t_test_string_1( "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE" ); | ||
dripline::uuid_t t_test_uuid_1; | ||
REQUIRE_NOTHROW( t_test_uuid_1 = dripline::uuid_from_string( t_test_string_1 ) ); | ||
REQUIRE_THAT( t_test_string_1, Catch::Equals(dripline::string_from_uuid(t_test_uuid_1), Catch::CaseSensitive::No) ); | ||
|
||
std::string t_test_string_2( "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" ); | ||
dripline::uuid_t t_test_uuid_2; | ||
REQUIRE_NOTHROW( t_test_uuid_2 = dripline::uuid_from_string( t_test_string_2 ) ); | ||
// compare to t_test_string_1 because the to_string conversion adds dashes and has no braces | ||
REQUIRE_THAT( t_test_string_1, Catch::Equals(dripline::string_from_uuid(t_test_uuid_2), Catch::CaseSensitive::No) ); | ||
|
||
std::string t_test_string_3( "AAAAAAAABBBBCCCCDDDDEEEEEEEEEEEE" ); | ||
dripline::uuid_t t_test_uuid_3; | ||
REQUIRE_NOTHROW( t_test_uuid_3 = dripline::uuid_from_string( t_test_string_3 ) ); | ||
// compare to t_test_string_1 because the to_string conversion adds dashes and has no braces | ||
REQUIRE_THAT( t_test_string_1, Catch::Equals(dripline::string_from_uuid(t_test_uuid_3), Catch::CaseSensitive::No) ); | ||
|
||
std::string t_test_string_4( "{AAAAAAAABBBBCCCCDDDDEEEEEEEEEEEE}" ); | ||
dripline::uuid_t t_test_uuid_4; | ||
REQUIRE_NOTHROW( t_test_uuid_4 = dripline::uuid_from_string( t_test_string_4 ) ); | ||
// compare to t_test_string_1 because the to_string conversion adds dashes and has no braces | ||
REQUIRE_THAT( t_test_string_1, Catch::Equals(dripline::string_from_uuid(t_test_uuid_4), Catch::CaseSensitive::No) ); | ||
} | ||
|
||
|
||
|
||
|