template.fmt 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 bd_info;
  24. struct lfs_bd_stats bd_stats;
  25. struct lfs_info info;
  26. uint8_t buffer[1024];
  27. uint8_t wbuffer[1024];
  28. uint8_t rbuffer[1024];
  29. lfs_size_t size;
  30. lfs_size_t wsize;
  31. lfs_size_t rsize;
  32. uintmax_t res;
  33. const struct lfs_config config = {{
  34. .bd = &bd,
  35. .bd_ops = &lfs_emubd_ops,
  36. }};
  37. int main() {{
  38. lfs_emubd_create(&bd, "blocks");
  39. {tests}
  40. lfs_emubd_destroy(&bd);
  41. }}