mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Added a rudimentary test framework
Tests can be found in 'tests/test_blah.sh' Tests can be run with 'make test'
This commit is contained in:
		
							
								
								
									
										45
									
								
								tests/template.fmt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								tests/template.fmt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| /// AUTOGENERATED TEST /// | ||||
| #include "lfs.h" | ||||
| #include "emubd/lfs_emubd.h" | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
| // test stuff | ||||
| void test_log(const char *s, uintmax_t v) {{ | ||||
|     printf("%s: %jd\n", s, v); | ||||
| }} | ||||
|  | ||||
| void test_assert(const char *s, uintmax_t v, uintmax_t e) {{ | ||||
|     test_log(s, v); | ||||
|     if (v != e) {{ | ||||
|         printf("\033[31massert %s failed, expected %jd\033[0m\n", s, e); | ||||
|         exit(-2); | ||||
|     }} | ||||
| }} | ||||
|  | ||||
| // lfs declarations | ||||
| lfs_t lfs; | ||||
| lfs_emubd_t bd; | ||||
| lfs_file_t file[4]; | ||||
| lfs_dir_t dir[4]; | ||||
| struct lfs_bd_info info; | ||||
| struct lfs_bd_stats stats; | ||||
|  | ||||
| uint8_t buffer[1024]; | ||||
| uint8_t wbuffer[1024]; | ||||
| uint8_t rbuffer[1024]; | ||||
| lfs_size_t size; | ||||
| lfs_size_t wsize; | ||||
| lfs_size_t rsize; | ||||
|  | ||||
| uintmax_t res; | ||||
|  | ||||
|  | ||||
| int main() {{ | ||||
|     lfs_emubd_create(&bd, "blocks"); | ||||
|  | ||||
| {tests} | ||||
|  | ||||
|     lfs_emubd_destroy(&bd); | ||||
| }} | ||||
		Reference in New Issue
	
	Block a user