-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartDay.sh
executable file
·60 lines (48 loc) · 1.39 KB
/
startDay.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
#! /bin/bash
year=$(date +'%Y')
echo 'Enter day: '
read -r inputDay
if [[ ${#inputDay} -eq 2 ]]; then
day="$inputDay"
else
day="0${inputDay}"
fi
echo 'Enter name: '
read -r name
lowerName=$(echo "${name}" | tr "[:upper:]" "[:lower:]")
mkdir "aoc-${year}/src/main/kotlin/day$day"
mkdir "aoc-${year}/src/test/kotlin/day$day"
mkdir "aoc-inputs/${year}/day$day"
touch "aoc-inputs/${year}/day$day/input.txt"
printf "package day%s
import utils.readInputLines
class %s(input: List<String>) {
}
fun main() {
val %s = %s(readInputLines(%s))
//println(%s.part1())
//println(%s.part2())
}
" "$day" "$name" "$lowerName" "$name" "$inputDay" "${lowerName}" "${lowerName}" > "aoc-${year}/src/main/kotlin/day$day/$name.kt"
printf "package day%s
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
class %sTest {
private val testInput = \"\"\"\"\"\".lines()
private val testSubject = %s(testInput)
@Test
fun \`should\`() {
}
@Test
fun \`should get correct answer for part 1\`() {
// assertThat(%s(readInputLines(%s)).part1())
// .isEqualTo()
}
@Test
fun \`should get correct answer for part 2\`() {
// assertThat(%s(readInputLines(%s)).part2())
// .isEqualTo()
}
}
" "$day" "$name" "$name" "$name" "$inputDay" "$name" "$inputDay" > "aoc-${year}/src/test/kotlin/day$day/${name}Test.kt"
git add .