Skip to content

Commit 6432855

Browse files
Added test for fs
1 parent aad3765 commit 6432855

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

tests-ffi/fs.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#include <cassert>
3+
extern "C" bool raw_is_path_exists(const char *path);
4+
5+
int main() {
6+
const char *valid_path = "../tests-ffi";
7+
const char *wrong_path = "../abcxyzw1133";
8+
9+
assert(raw_is_path_exists(valid_path));
10+
assert(!raw_is_path_exists(wrong_path));
11+
12+
return 0;
13+
}

tests-ffi/tests.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ function run_ffi_test() {
4343
fi
4444

4545
for file in *.cxx; do
46+
build_output=$(basename "$file" ".cxx")
4647
file_name=$(basename "$file")
4748

48-
$clang_cxx "$file" "$static_lib_path" -o "$build_dir/$file_name"
49+
$clang_cxx "$file" "$static_lib_path" -o "$build_dir/$build_output"
4950
echo
50-
echo -e "\e[0;32m[+] Test for $file_name:\e[0;37m"
51-
./"$build_dir/$file_name"
51+
echo -e -n "\e[0;32m[+] Test for $file_name:\e[0;37m"
5252

53-
echo -e "\e[0;32m[+] Test for $file_name success with status code: $?\e[0;37m"
53+
time_test=$( {
54+
time ./"$build_dir/$build_output"
55+
} )
56+
57+
status_code=$?
58+
echo -e -n "$time_test"
59+
echo -e "\e[0;32m[+] Test for $file_name success with status code: $status_code\e[0;37m"
5460

5561
for _ in {1..25}; do
5662
printf "_"

0 commit comments

Comments
 (0)