Skip to content

Commit e51f25d

Browse files
this time
1 parent 48f533d commit e51f25d

File tree

2 files changed

+0
-93
lines changed

2 files changed

+0
-93
lines changed

code/tests/cases/test_syscall.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -123,54 +123,6 @@ FOSSIL_TEST(c_test_sys_call_getcwd_and_chdir) {
123123
fossil_sys_call_delete_directory("cwd_test", 0);
124124
}
125125

126-
FOSSIL_TEST(c_test_sys_call_list_directory) {
127-
const char *dirname = "list_dir";
128-
fossil_sys_call_create_directory(dirname);
129-
char fname1[256], fname2[256];
130-
#if defined(_WIN32)
131-
snprintf(fname1, sizeof(fname1), "%s\\a.txt", dirname);
132-
snprintf(fname2, sizeof(fname2), "%s\\b.txt", dirname);
133-
#else
134-
snprintf(fname1, sizeof(fname1), "%s/a.txt", dirname);
135-
snprintf(fname2, sizeof(fname2), "%s/b.txt", dirname);
136-
#endif
137-
FILE *f1 = fopen(fname1, "w");
138-
FILE *f2 = fopen(fname2, "w");
139-
if (f1) fclose(f1);
140-
if (f2) fclose(f2);
141-
142-
char **list = NULL;
143-
size_t count = 0;
144-
int result = fossil_sys_call_list_directory(dirname, &list, &count);
145-
ASSUME_ITS_TRUE(result == 0);
146-
ASSUME_ITS_TRUE(count >= 2);
147-
for (size_t i = 0; i < count; ++i) free(list[i]);
148-
free(list);
149-
150-
fossil_sys_call_delete_file(fname1);
151-
fossil_sys_call_delete_file(fname2);
152-
fossil_sys_call_delete_directory(dirname, 0);
153-
}
154-
155-
FOSSIL_TEST(c_test_sys_call_is_directory_and_is_file) {
156-
const char *dirname = "type_dir";
157-
const char *filename = "type_file.txt";
158-
fossil_sys_call_create_directory(dirname);
159-
FILE *f = fopen(filename, "w");
160-
if (f) fclose(f);
161-
ASSUME_ITS_TRUE(fossil_sys_call_is_directory(dirname) == 1);
162-
ASSUME_ITS_TRUE(fossil_sys_call_is_file(filename) == 1);
163-
fossil_sys_call_delete_file(filename);
164-
fossil_sys_call_delete_directory(dirname, 0);
165-
}
166-
167-
FOSSIL_TEST(c_test_sys_call_sleep) {
168-
int start = fossil_sys_call_getpid(); // Just to use something
169-
fossil_sys_call_sleep(1); // Sleep for 1 ms (may be longer on some platforms)
170-
int end = fossil_sys_call_getpid();
171-
ASSUME_ITS_TRUE(start == end); // PID should not change
172-
}
173-
174126
FOSSIL_TEST(c_test_sys_call_execute_capture) {
175127
char buffer[128];
176128
int result = fossil_sys_call_execute_capture("echo HelloWorld", buffer, sizeof(buffer));
@@ -192,9 +144,6 @@ FOSSIL_TEST_GROUP(c_syscall_tests) {
192144
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_delete_directory_non_recursive);
193145
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_delete_directory_recursive);
194146
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_getcwd_and_chdir);
195-
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_list_directory);
196-
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_is_directory_and_is_file);
197-
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_sleep);
198147
FOSSIL_TEST_ADD(c_syscall_suite, c_test_sys_call_execute_capture);
199148

200149
FOSSIL_TEST_REGISTER(c_syscall_suite);

code/tests/cases/test_syscall.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -119,44 +119,6 @@ FOSSIL_TEST(cpp_test_sys_call_delete_directory) {
119119
ASSUME_ITS_TRUE(result == 0);
120120
}
121121

122-
FOSSIL_TEST(cpp_test_sys_call_is_directory) {
123-
const std::string dirname = "test_is_dir";
124-
fossil::sys::Syscall::create_directory(dirname);
125-
int is_dir = fossil::sys::Syscall::is_directory(dirname);
126-
ASSUME_ITS_TRUE(is_dir == 1);
127-
fossil::sys::Syscall::delete_directory(dirname, 0);
128-
}
129-
130-
FOSSIL_TEST(cpp_test_sys_call_is_file) {
131-
const std::string filename = "test_is_file.txt";
132-
fossil::sys::Syscall::create_file(filename);
133-
int is_file = fossil::sys::Syscall::is_file(filename);
134-
ASSUME_ITS_TRUE(is_file == 1);
135-
fossil::sys::Syscall::delete_file(filename);
136-
}
137-
138-
FOSSIL_TEST(cpp_test_sys_call_chdir_and_getcwd) {
139-
const std::string dirname = "test_chdir_dir";
140-
fossil::sys::Syscall::create_directory(dirname);
141-
std::string cwd_str_before(256, '\0');
142-
fossil::sys::Syscall::getcwd(&cwd_str_before, cwd_str_before.size());
143-
int chdir_result = fossil::sys::Syscall::chdir(dirname);
144-
ASSUME_ITS_TRUE(chdir_result == 0);
145-
std::string cwd_str_after(256, '\0');
146-
fossil::sys::Syscall::getcwd(&cwd_str_after, cwd_str_after.size());
147-
ASSUME_ITS_TRUE(cwd_str_after.find(dirname) != std::string::npos);
148-
fossil::sys::Syscall::chdir(cwd_str_before);
149-
fossil::sys::Syscall::delete_directory(dirname, 0);
150-
}
151-
152-
FOSSIL_TEST(cpp_test_sys_call_sleep) {
153-
auto start = std::chrono::steady_clock::now();
154-
fossil::sys::Syscall::sleep(100);
155-
auto end = std::chrono::steady_clock::now();
156-
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
157-
ASSUME_ITS_TRUE(elapsed >= 90); // Allow some tolerance
158-
}
159-
160122
FOSSIL_TEST(cpp_test_sys_call_execute_capture) {
161123
std::string buffer(128, '\0');
162124
int result = fossil::sys::Syscall::execute_capture("echo FossilCapture", &buffer);
@@ -180,10 +142,6 @@ FOSSIL_TEST_GROUP(cpp_syscall_tests) {
180142
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_file_exists);
181143
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_create_directory);
182144
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_delete_directory);
183-
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_is_directory);
184-
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_is_file);
185-
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_chdir_and_getcwd);
186-
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_sleep);
187145
FOSSIL_TEST_ADD(cpp_syscall_suite, cpp_test_sys_call_execute_capture);
188146

189147
FOSSIL_TEST_REGISTER(cpp_syscall_suite);

0 commit comments

Comments
 (0)