1
0

hbase_test.c 689 B

12345678910111213141516171819202122232425262728
  1. #include "hbase.h"
  2. int main(int argc, char* argv[]) {
  3. assert(hv_getboolean("1"));
  4. assert(hv_getboolean("yes"));
  5. assert(hv_parse_size("256") == 256);
  6. assert(hv_parse_size("1K") == 1024);
  7. assert(hv_parse_size("1G2M3K4B") ==
  8. 1 * 1024 * 1024 * 1024 +
  9. 2 * 1024 * 1024 +
  10. 3 * 1024 +
  11. 4);
  12. assert(hv_parse_time("30") == 30);
  13. assert(hv_parse_time("1m") == 60);
  14. assert(hv_parse_time("1d2h3m4s") ==
  15. 1 * 24 * 60 * 60 +
  16. 2 * 60 * 60 +
  17. 3 * 60 +
  18. 4);
  19. char buf[16] = {0};
  20. printf("%d\n", hv_rand(10, 99));
  21. printf("%s\n", hv_random_string(buf, 10));
  22. return 0;
  23. }