diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-09-08 15:24:03 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-09-08 15:24:03 +0800 |
commit | 102c9b797a89039b8f79f6727a017e2f4d5610b7 (patch) | |
tree | 7ebc2bf4be36a9eaaf647c24dfbf060fd796cf3c /test/bls_test.cpp | |
parent | 1ada521ca01a12654337ce292b6c6e6f18a90580 (diff) | |
download | dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.tar dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.tar.gz dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.tar.bz2 dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.tar.lz dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.tar.xz dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.tar.zst dexon-bls-102c9b797a89039b8f79f6727a017e2f4d5610b7.zip |
mask the top two bit of array for Id::set and SecretKey::set
Diffstat (limited to 'test/bls_test.cpp')
-rw-r--r-- | test/bls_test.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/test/bls_test.cpp b/test/bls_test.cpp index 9d3a7cb..013b242 100644 --- a/test/bls_test.cpp +++ b/test/bls_test.cpp @@ -49,13 +49,31 @@ CYBOZU_TEST_AUTO(id) } { /* - exception if the value >= r + mask value to be less than r if the value >= r */ - const uint64_t id1[] = { 0, 0, 0, uint64_t(-1) }; - CYBOZU_TEST_EXCEPTION(id.set(id1), std::exception); + const uint64_t tbl1[] = { 0, 0, 0, uint64_t(-1) }; + id.set(tbl1); + const uint64_t tbl2[] = { 0, 0, 0, uint64_t(-1) & ((uint64_t(1) << 63) - 1) }; + bls::Id id2; + id2.set(tbl2); + CYBOZU_TEST_EQUAL(id, id2); } } +CYBOZU_TEST_AUTO(SecretKey_set) +{ + /* + mask value to be less than r if the value >= r + */ + bls::SecretKey sec1, sec2; + const uint64_t tbl1[] = { 0, 0, 0, uint64_t(-1) }; + sec1.set(tbl1); + const uint64_t tbl2[] = { 0, 0, 0, uint64_t(-1) & ((uint64_t(1) << 63) - 1) }; + bls::Id expected; + sec2.set(tbl2); + CYBOZU_TEST_EQUAL(sec1, sec2); +} + CYBOZU_TEST_AUTO(k_of_n) { const std::string m = "abc"; |