map_test.hxx 924 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef MAP_TEST_HXX
  2. #define MAP_TEST_HXX
  3. #include "tester.hxx"
  4. #include "libbinom/include/variables/map.hxx"
  5. #include "print_variable.hxx"
  6. void testMap() {
  7. using namespace binom::literals;
  8. using namespace binom;
  9. RAIIPerfomanceTest test_perf("Map test: ");
  10. SEPARATOR
  11. TEST_ANNOUNCE(Map test)
  12. GRP_PUSH
  13. LOG("(bug in [r]): binom::Map _map = map{{1, 2},{3, 4}, {\"Hello\", \"World\"}};");
  14. binom::Map _map = map{{1, 2},{3, 4}, {"Hello", "World"}};
  15. utils::printVariable(_map);
  16. SEPARATOR
  17. PRINT_RUN(_map[4] = 5;)
  18. LOG("Requesting a non-existent element via an \"[]\" operator results in the creation of that element with a value of NULL:")
  19. PRINT_RUN(_map[KeyValue(nullptr)];)
  20. PRINT_RUN(_map[-1] = 0_ui32;)
  21. LOG("(bug in [r]): _map[6] = i32arr{7,8,9,10};");
  22. _map[6] = i32arr{7,8,9,10};
  23. utils::printVariable(_map.move());
  24. GRP_POP
  25. }
  26. #endif // MAP_TEST_HXX