-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrapper.sh
63 lines (58 loc) · 2.79 KB
/
bootstrapper.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module=${1,,}
module_cap=${module^^}
echo $module
echo $module_cap
echo "#ifndef ${module_cap}_H" > src/$module.h
echo "#define ${module_cap}_H" >> src/$module.h
echo "" >> src/$module.h
echo "#include <stdint.h>" >> src/$module.h
echo "" >> src/$module.h
echo "void $module(uint16_t instr);" >> src/$module.h
echo "" >> src/$module.h
echo "#endif // ${module_cap}_H" >> src/$module.h
echo "" >> src/$module.h
echo "#include <stdlib.h>" > src/$module.c
echo "" >> src/$module.c
echo "#include \"$module.h\"" >> src/$module.c
echo "" >> src/$module.c
echo "void $module(uint16_t instr) {" >> src/$module.c
echo "}" >> src/$module.c
echo "" >> src/$module.c
echo "#ifndef ${module_cap}_TEST_H" > tests/unit_test/${module}_test.h
echo "#define ${module_cap}_TEST_H" >> tests/unit_test/${module}_test.h
echo "" >> tests/unit_test/${module}_test.h
echo "#include <check.h>" >> tests/unit_test/${module}_test.h
echo "" >> tests/unit_test/${module}_test.h
echo "Suite *make_${module}_test_suite();" >> tests/unit_test/${module}_test.h
echo "" >> tests/unit_test/${module}_test.h
echo "#endif // ${module_cap}_TEST_H" >> tests/unit_test/${module}_test.h
echo "#include <check.h>" > tests/unit_test/${module}_test.c
echo "#include <unistd.h>" >> tests/unit_test/${module}_test.c
echo "#include <stdlib.h>" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo "#include \"../../src/$module.h\"" >> tests/unit_test/${module}_test.c
echo "#include \"${module}_test.h\"" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo "START_TEST(it_is_an_entrypoint)" >> tests/unit_test/${module}_test.c
echo "{" >> tests/unit_test/${module}_test.c
echo "// Arrange" >> tests/unit_test/${module}_test.c
echo "// Act" >> tests/unit_test/${module}_test.c
echo "// Assert" >> tests/unit_test/${module}_test.c
echo "}" >> tests/unit_test/${module}_test.c
echo "END_TEST" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo "Suite *make_${module}_test_suite()" >> tests/unit_test/${module}_test.c
echo "{" >> tests/unit_test/${module}_test.c
echo " Suite *s;" >> tests/unit_test/${module}_test.c
echo " TCase *tc;" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo " s = suite_create(\"${module^}\");" >> tests/unit_test/${module}_test.c
echo " tc = tcase_create(\"Core\");" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo " tcase_add_test(tc, it_is_an_entrypoint);" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo " suite_add_tcase(s, tc);" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c
echo " return s;" >> tests/unit_test/${module}_test.c
echo "}" >> tests/unit_test/${module}_test.c
echo "" >> tests/unit_test/${module}_test.c