types_ut.cpp 691 B

1234567891011121314151617181920212223
  1. #include "types.h"
  2. #include <library/cpp/testing/unittest/registar.h>
  3. Y_UNIT_TEST_SUITE(TestTypes) {
  4. Y_UNIT_TEST(TestScanf) {
  5. i32 val32 = 0;
  6. sscanf("-123", "%" SCNi32, &val32);
  7. UNIT_ASSERT(val32 == -123);
  8. sscanf("234", "%" SCNu32, &val32);
  9. UNIT_ASSERT(val32 == 234);
  10. sscanf("159", "%" SCNx32, &val32);
  11. UNIT_ASSERT(val32 == 345);
  12. i64 val64 = 0;
  13. sscanf("-123", "%" SCNi64, &val64);
  14. UNIT_ASSERT(val64 == -123);
  15. sscanf("234", "%" SCNu64, &val64);
  16. UNIT_ASSERT(val64 == 234);
  17. sscanf("159", "%" SCNx64, &val64);
  18. UNIT_ASSERT(val64 == 345);
  19. }
  20. } // Y_UNIT_TEST_SUITE(TestTypes)