test: move all module tests to the test/ directory
This commit is contained in:
32
test/io/tree.c
Normal file
32
test/io/tree.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <blue/io/directory.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define NRAND_NUMBERS 12
|
||||
#define NRAND_BYTES 128
|
||||
#define NRAND_DOUBLES 8
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
b_directory *dir = NULL;
|
||||
b_path *path = b_path_create_from_cstr(argv[1]);
|
||||
b_result result = b_directory_open(B_DIRECTORY_ROOT, path, 0, &dir);
|
||||
|
||||
if (b_result_is_error(result)) {
|
||||
b_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
b_iterator *it = b_directory_begin(dir, B_DIRECTORY_ITERATE_PARENT_FIRST);
|
||||
b_foreach(b_directory_entry *, entry, it)
|
||||
{
|
||||
printf("%s\n", b_path_ptr(entry->filepath));
|
||||
}
|
||||
|
||||
b_iterator_unref(it);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user