diff options
Diffstat (limited to '3rdparty/bx/tests/crt_test.cpp')
-rw-r--r-- | 3rdparty/bx/tests/crt_test.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/3rdparty/bx/tests/crt_test.cpp b/3rdparty/bx/tests/crt_test.cpp index bda079036ee..68476a12cfa 100644 --- a/3rdparty/bx/tests/crt_test.cpp +++ b/3rdparty/bx/tests/crt_test.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2010-2018 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + * Copyright 2010-2022 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx/blob/master/LICENSE */ #include "test.h" @@ -23,14 +23,14 @@ TEST_CASE("memSet", "") TEST_CASE("memMove", "") { - const char* orignal = "xxxxabvgd"; + const char* original = "xxxxabvgd"; char str[] = { 'x', 'x', 'x', 'x', 'a', 'b', 'v', 'g', 'd' }; bx::memMove(&str[4], &str[4], 0); - REQUIRE(0 == bx::memCmp(str, orignal, 9) ); + REQUIRE(0 == bx::memCmp(str, original, 9) ); bx::memMove(&str[4], &str[4], 5); - REQUIRE(0 == bx::memCmp(str, orignal, 9) ); + REQUIRE(0 == bx::memCmp(str, original, 9) ); bx::memMove(str, &str[4], 5); REQUIRE(0 == bx::memCmp(str, "abvgd", 5) ); @@ -39,5 +39,20 @@ TEST_CASE("memMove", "") REQUIRE(str[4] == 'a' ); bx::memSet(str, 'x', 4); - REQUIRE(0 == bx::memCmp(str, orignal, 9) ); + REQUIRE(0 == bx::memCmp(str, original, 9) ); +} + +TEST_CASE("scatter/gather", "") +{ + const char* str = "a\0b\0v\0g\0d"; + + char tmp0[64]; + bx::gather(tmp0, str, 2, 1, 5); + REQUIRE(0 == bx::memCmp(tmp0, "abvgd", 5) ); + + char tmp1[64]; + bx::scatter(tmp1, 2, tmp0, 1, 5); + bx::memSet(&tmp1[1], 2, 0, 1, 5); + REQUIRE(0 == bx::memCmp(tmp1, str, 5) ); + } |