diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2024-11-14 14:27:00 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2024-11-14 14:27:00 -0500 |
| commit | 285886342da1b98f989f39d49bef6ac606f25d73 (patch) | |
| tree | 1045308d1389790bf5b2edde0623f86a31dc0438 /test | |
| parent | b2fd1ffdf4e173a8b2920663bd8e1e2f478cc0b3 (diff) | |
pkmem-types: add test for derived pk_handle
Diffstat (limited to 'test')
| -rw-r--r-- | test/pkmem-types.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/pkmem-types.cpp b/test/pkmem-types.cpp index b8e19ef..0dc0f90 100644 --- a/test/pkmem-types.cpp +++ b/test/pkmem-types.cpp @@ -61,5 +61,36 @@ int main(int argc, char *argv[]) PK_LOGV_INF("pk_handle_validate_constexpr: 000: %i\n", ret4); } + // custom pk_handle_validate + { + struct custom_handle : public pk_handle{}; + struct custom_handle h, bh; + bool res; + + struct custom_handle ch1; ch1.bucketIndex = 0xAAAAAAAA; ch1.itemIndex = 0x55555555; + struct custom_handle cbh1; cbh1.bucketIndex = 0xAAAAAAAA; cbh1.itemIndex = 0x55555555; + bool ret1 = (ch1 == cbh1); + PK_LOGV_INF("custom_handle constexpr operator== 000: %b\n", ret1); + + struct custom_handle ch2; ch2.bucketIndex = 0x00000000; ch2.itemIndex = 0x00000000; + struct custom_handle cbh2; cbh2.bucketIndex = 0xFFFFFFFF; cbh2.itemIndex = 0xFFFFFFFF; + bool ret2 = (ch2 == cbh2); + PK_LOGV_INF("custom_handle constexpr operator== 001: %b\n", ret2); + + h.bucketIndex = 0xCAFE; + h.itemIndex = 0xBABE; + bh.bucketIndex = 0xCAFE; + bh.itemIndex = 0xBABE; + res = h == bh; + PK_LOGV_INF("custom_handle operator== 000: %b\n", res); + + h.bucketIndex = 0x00000000; + h.itemIndex = 0x00000000; + bh.bucketIndex = 0xFFFFFFFF; + bh.itemIndex = 0xFFFFFFFF; + res = h == bh; + PK_LOGV_INF("custom_handle operator== 001: %b\n", res); + } + return 0; } |
