mirror of
https://github.com/apache/arrow.git
synced 2026-10-28 16:47:19 +08:00
Remove unused unit test for sha128 on gandiva
This commit is contained in:
1 parent
3f4d0fa3e5
commit
e479d4a6fa
1 file changed
-59
@@ -160,63 +160,4 @@ TEST(TestGdvFnStubs, TestCastFloat8) {
|
||||
ctx.Reset();
|
||||
}
|
||||
|
||||
TEST(TestGdvFnStubs, TestSha128Numeric) {
|
||||
gandiva::ExecutionContext ctx;
|
||||
|
||||
int64_t ctx_ptr = reinterpret_cast<int64_t>(&ctx);
|
||||
|
||||
// test zero boundaries
|
||||
const char *zero_hash = gdv_fn_sha128_from_numeric(ctx_ptr, 0.0);
|
||||
const char *zero_one_hash = gdv_fn_sha128_from_numeric(ctx_ptr, 0.1);
|
||||
|
||||
EXPECT_STRNE(zero_hash, zero_one_hash);
|
||||
|
||||
// tests minus zero case
|
||||
const char *minus_zero_hash = gdv_fn_sha128_from_numeric(ctx_ptr, -0.0);
|
||||
|
||||
EXPECT_STREQ(zero_hash, minus_zero_hash);
|
||||
|
||||
ctx.Reset();
|
||||
}
|
||||
|
||||
TEST(TestGdvFnStubs, TestSha128String) {
|
||||
gandiva::ExecutionContext ctx;
|
||||
|
||||
int64_t ctx_ptr = reinterpret_cast<int64_t>(&ctx);
|
||||
|
||||
const char *zero_hash = gdv_fn_sha128_from_numeric(ctx_ptr, 0.0);
|
||||
|
||||
const char *test_string = "ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn\n"
|
||||
"Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]";
|
||||
|
||||
const char *first_sha_hash = gdv_fn_hash_sha128_from_string(ctx_ptr, test_string, strlen(test_string));
|
||||
|
||||
const char *expected_first_hash ="160fcdbc2fa694d884868f5fae7a4bae82706185";
|
||||
|
||||
EXPECT_STRNE(first_sha_hash, zero_hash);
|
||||
EXPECT_STREQ(expected_first_hash, first_sha_hash);
|
||||
|
||||
const char *test_string_modified = "ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeın\n"
|
||||
"Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ] コンニチハ";
|
||||
|
||||
const char
|
||||
*second_sha_hash = gdv_fn_hash_sha128_from_string(ctx_ptr, test_string_modified, strlen(test_string_modified));
|
||||
|
||||
const char *expected_second_hash ="a456b3e0f88669d2482170a42fade226a815bee1";
|
||||
|
||||
EXPECT_STREQ(expected_second_hash,second_sha_hash);
|
||||
EXPECT_STRNE(second_sha_hash, first_sha_hash);
|
||||
|
||||
const char *empty_string_hash = gdv_fn_hash_sha128_from_string(ctx_ptr, "", strlen(""));
|
||||
|
||||
EXPECT_STREQ("da39a3ee5e6b4b0d3255bfef95601890afd80709",empty_string_hash);
|
||||
|
||||
gdv_fn_hash_sha128_from_string(ctx_ptr, nullptr, 0);
|
||||
|
||||
EXPECT_THAT(ctx.get_error(),
|
||||
::testing::HasSubstr("A null value was given to be hashed."));
|
||||
|
||||
ctx.Reset();
|
||||
}
|
||||
|
||||
} // namespace gandiva
|
||||
Reference in new issue
Block a user