hash_ops_ut.cpp 861 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "hash_ops.h"
  2. #include <library/cpp/testing/unittest/registar.h>
  3. Y_UNIT_TEST_SUITE(TestCIHash) {
  4. Y_UNIT_TEST(TestYHash1) {
  5. THashMap<TStringBuf, int, TCIOps, TCIOps> h;
  6. h["Ab"] = 1;
  7. h["aB"] = 2;
  8. UNIT_ASSERT_VALUES_EQUAL(h.size(), 1);
  9. UNIT_ASSERT_VALUES_EQUAL(h["ab"], 2);
  10. }
  11. Y_UNIT_TEST(TestYHash2) {
  12. THashMap<const char*, int, TCIOps, TCIOps> h;
  13. h["Ab"] = 1;
  14. h["aB"] = 2;
  15. UNIT_ASSERT_VALUES_EQUAL(h.size(), 1);
  16. UNIT_ASSERT_VALUES_EQUAL(h["ab"], 2);
  17. h["Bc"] = 2;
  18. h["bC"] = 3;
  19. UNIT_ASSERT_VALUES_EQUAL(h.size(), 2);
  20. UNIT_ASSERT_VALUES_EQUAL(h["bc"], 3);
  21. }
  22. Y_UNIT_TEST(Test1) {
  23. UNIT_ASSERT_VALUES_EQUAL(TCIOps()("aBc3"), TCIOps()(TStringBuf("AbC3")));
  24. UNIT_ASSERT(TCIOps()("aBc4", "AbC4"));
  25. }
  26. }