template.fmt 798 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /// AUTOGENERATED TEST ///
  2. #include "lfs.h"
  3. #include "emubd/lfs_emubd.h"
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <stdlib.h>
  7. // test stuff
  8. void test_log(const char *s, uintmax_t v) {{
  9. printf("%s: %jd\n", s, v);
  10. }}
  11. void test_assert(const char *s, uintmax_t v, uintmax_t e) {{
  12. test_log(s, v);
  13. if (v != e) {{
  14. printf("\033[31massert %s failed, expected %jd\033[0m\n", s, e);
  15. exit(-2);
  16. }}
  17. }}
  18. // lfs declarations
  19. lfs_t lfs;
  20. lfs_emubd_t bd;
  21. lfs_file_t file[4];
  22. lfs_dir_t dir[4];
  23. struct lfs_bd_info info;
  24. struct lfs_bd_stats stats;
  25. uint8_t buffer[1024];
  26. uint8_t wbuffer[1024];
  27. uint8_t rbuffer[1024];
  28. lfs_size_t size;
  29. lfs_size_t wsize;
  30. lfs_size_t rsize;
  31. uintmax_t res;
  32. int main() {{
  33. lfs_emubd_create(&bd, "blocks");
  34. {tests}
  35. lfs_emubd_destroy(&bd);
  36. }}