summaryrefslogtreecommitdiffstats
path: root/02_exercise/prompt_utils_test.c
diff options
context:
space:
mode:
authorStefan Zabka <zabkaste@hu-berlin.de>2020-05-24 12:09:46 +0200
committerStefan Zabka <zabkaste@hu-berlin.de>2020-05-24 12:09:46 +0200
commit65966ded0cc15c5966c6568cf0ff2f2bbe1fc29a (patch)
tree60af69be16926ef0f24ad2a954d9205ce9277450 /02_exercise/prompt_utils_test.c
parent3b7e61eab8ce5d230bc1b172942c1ab9459ed161 (diff)
downloadbetriebssysteme-65966ded0cc15c5966c6568cf0ff2f2bbe1fc29a.tar.gz
betriebssysteme-65966ded0cc15c5966c6568cf0ff2f2bbe1fc29a.zip
Big remodelling
Diffstat (limited to '02_exercise/prompt_utils_test.c')
-rw-r--r--02_exercise/prompt_utils_test.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/02_exercise/prompt_utils_test.c b/02_exercise/prompt_utils_test.c
deleted file mode 100644
index 8bc29de..0000000
--- a/02_exercise/prompt_utils_test.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "array.h"
-#include "prompt_utils.h"
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-void test_get_separator_indices() {
- char const *const test_str = "/This/is/a/test";
- size_t const *const result = get_separator_indices(test_str, '/');
- for (size_t i = 0; i < arrayLen(result); i++) {
- printf("%ld : %s \n", result[i], test_str + result[i]);
- }
-}
-void test_paths(char const *const from, char const *const to,
- char const *const expected) {
- size_t const *const result = get_separator_indices(from, '/');
- for (size_t i = 0; i < arrayLen(result); i++) {
- printf("%ld : %s \n", result[i], from + result[i]);
- }
- size_t const *const result2 = get_separator_indices(to, '/');
- for (size_t i = 0; i < arrayLen(result2); i++) {
- printf("%ld : %s \n", result2[i], to + result2[i]);
- }
- char const *const path = relative_path(from, to);
- printf("The relative path of %s to %s is %s \n", from, to, path);
-
- assert(strcmp(path, expected) == 0);
-}
-void test_relative_path() {
- test_paths("/Test", "/Test/a", "./a");
- test_paths("/abc/def/ghi", "/abc/def/ghi", ".");
- test_paths("/Test", "/Test/a/asd", "./a/asd");
- test_paths("/Test/b/c", "/Test/b", "..");
- test_paths("/", "/Test/a/asd", "./Test/a/asd");
- test_paths("/Test/c", "/Test/b", "../b");
- test_paths("/B/C", "/", "../..");
-}
-
-/*
-int main(void) {
- test_relative_path();
- test_get_separator_indices();
- return 0;
-}
-*/