-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcreate_header.sh
More file actions
executable file
·97 lines (54 loc) · 1.25 KB
/
Copy pathcreate_header.sh
File metadata and controls
executable file
·97 lines (54 loc) · 1.25 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
if (($# != 1)); then
echo "tools/create_header.sh <headerName>"
exit 1
fi
set -e
mkdir -p "tests/$1"
touch "headers/$1.h" "docs/$1.md" "tests/$1/$1.md" "tests/$1/$1.cpp" "tests/$1/$1_bf.cpp" "tests/$1/$1_gen.cpp" "tests/$1/$1_check.cpp"
headerdefine=CPTH_${1^^}
echo "// Get more headers at https://github.com/ouuan/CPTH
#ifndef $headerdefine
#define $headerdefine
namespace CPTH
{
} // namespace CPTH
#endif // $headerdefine" > "headers/$1.h"
echo "## $1
" > "docs/$1.md"
echo "#include \"$1.h\"
#include <iostream>
#include <cstdio>
int main()
{
return 0;
}" > "tests/$1/$1.cpp"
echo '#include <iostream>
#include <cstdio>
int main()
{
return 0;
}' > "tests/$1/$1_bf.cpp"
echo '#include <chrono>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <random>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int randint(int l, int r) { return rnd() % (r - l + 1) + l; }
int main()
{
return 0;
}' > "tests/$1/$1_gen.cpp"
echo '#include "checkers/"' > "tests/$1/$1_check.cpp"
echo "## $1
### Description
### Input
### Output
" > "tests/$1/$1.md"
echo "
## $1
- [$1.h](headers/$1.h)
- [$1.md](docs/$1.md)
- [$1.cpp](tests/$1/$1.cpp)" >> HEADER_LIST.md