1
0

test-stringToLongLong.cpp 1.4 KB

1234567891011121314151617181920212223
  1. TEST(stringToLongLong) {
  2. ensure(stringToLongLong(inf, "1234567891") == 1234567891LL);
  3. ensure(stringToLongLong(inf, "-47292722921111") == -47292722921111LL);
  4. ensure(stringToLongLong(inf, "0") == 0LL);
  5. ensure(stringToLongLong(inf, "9223372036854775807") == 9223372036854775807LL);
  6. ensure(stringToLongLong(inf, "-9223372036854775808") == -9223372036854775807LL - 1LL);
  7. ensure_exit(3, [](){stringToLongLong(inf, "");});
  8. ensure_exit(3, [](){stringToLongLong(inf, "-");});
  9. ensure_exit(3, [](){stringToLongLong(inf, "+");});
  10. ensure_exit(3, [](){stringToLongLong(inf, "00");});
  11. ensure_exit(3, [](){stringToLongLong(inf, "0123");});
  12. ensure_exit(3, [](){stringToLongLong(inf, "+123");});
  13. ensure_exit(3, [](){stringToLongLong(inf, "09223372036854775807");});
  14. ensure_exit(3, [](){stringToLongLong(inf, "9223372036854775808");});
  15. ensure_exit(3, [](){stringToLongLong(inf, "-09223372036854775808");});
  16. ensure_exit(3, [](){stringToLongLong(inf, "-9223372036854775809");});
  17. ensure_exit(3, [](){stringToLongLong(inf, "1 ");});
  18. ensure_exit(3, [](){stringToLongLong(inf, " 1");});
  19. ensure_exit(3, [](){stringToLongLong(inf, "1 2");});
  20. ensure_exit(3, [](){stringToLongLong(inf, "-0");});
  21. ensure_exit(3, [](){stringToLongLong(inf, "--0");});
  22. ensure_exit(3, [](){stringToLongLong(inf, "123-");});
  23. }