-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.ps1
186 lines (149 loc) · 4.64 KB
/
test.ps1
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# ########################################################################## #
# Frame (©2023 Lelanthran Manickum) #
# #
# This program comes with ABSOLUTELY NO WARRANTY. This is free software #
# and you are welcome to redistribute it under certain conditions; see #
# the LICENSE file for details. #
# ########################################################################## #
param (
[switch]$mono
)
$DBPATH="$Env:TEMP\frame"
$PROG="$PWD\recent\bin\x86_64-w64-mingw32\frame.exe"
if ($mono -eq $false) {
$NC="[0m"
$INV="[7m"
$RED="[31m"
$GREEN="[32m"
$BLUE="[34m"
$CYAN="[36m"
$YELLOW="[33m"
$HI_ON="$RED$NV"
}
$STMT_NUM=0
$LIMIT="$1"
echo Removing $DBPATH
Remove-Item $DBPATH -Recurse -Force
function Execute-Frame {
Param (
[string]$p1,
[string]$p2,
[string]$p3,
[string]$p4,
[string]$p5
)
echo "${RED}Executing $NC$GREEN$global:STMT_NUM$NC$BLUE $p1 $p2 $p3 $p4 $p5$NC"
$global:STMT_NUM++
& "$p1" "$p2" "$p3" "$p4" "$p5" "--dbpath=$DBPATH" "--quiet"
if ($LastExitCode -ne 0) {
die "Command Failure"
}
}
function die {
Param (
[string] $msg
)
echo $msg
exit -1
}
Execute-Frame $PROG create
Execute-Frame $PROG status
Execute-Frame $PROG history
echo Created
Execute-Frame $PROG replace --message="Root: replacement"
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG push one --message="One: message one"
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG append --message="\nMessage: 1\n"
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG up
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG push two --message="Two: message two"
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG top
Execute-Frame $PROG down one
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG back 1
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG back 1
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG push three --message="three: three"
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG pop
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG push four --message="four: four"
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG delete root/two
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG top
Execute-Frame $PROG status
Execute-Frame $PROG history
Execute-Frame $PROG push five --message="five: five"
Execute-Frame $PROG up
Execute-Frame $PROG push six --message="six: six"
Execute-Frame $PROG up
Execute-Frame $PROG push seven --message="seven: seven"
Execute-Frame $PROG up
Execute-Frame $PROG push eight --message="eight: eight"
Execute-Frame $PROG up
Execute-Frame $PROG push eighteen --message="eight: eight"
Execute-Frame $PROG up
Execute-Frame $PROG push eighty --message="eight: eight"
Execute-Frame $PROG up
Execute-Frame $PROG down one
Execute-Frame $PROG push one --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push two --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push three --message="new one"
Execute-Frame $PROG up
# execute $PROG push four --message="new one"
# execute $PROG up
Execute-Frame $PROG push five --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push six --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push seven --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push eight --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push nine --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG push ten --message="new one"
Execute-Frame $PROG up
Execute-Frame $PROG status
Execute-Frame $PROG list
# Current node is root/one
Execute-Frame $PROG match --from-root "e"
Execute-Frame $PROG match --from-root "ei"
Execute-Frame $PROG match --from-root "eigh"
Execute-Frame $PROG match "e"
Execute-Frame $PROG match "ei"
Execute-Frame $PROG match "eigh"
Execute-Frame $PROG match "eigh" --invert
Execute-Frame $PROG status
Execute-Frame $PROG match "one/egh" > t
# if [ `wc -l t | cut -f 1 -d \ ` -ne 1 ]; then
# die expected failed match
# fi
# Rename root/one/five
Execute-Frame $PROG switch root/one/five
Execute-Frame $PROG rename 'FIVE'
# Current node is root/one/FIVE
Execute-Frame $PROG status
Execute-Frame $PROG match --from-root "one/ei"
Execute-Frame $PROG tree
echo 'Use [sed "s:(.\+)::g"] to strip the dates'
exit 0