about summary refs log tree commit diff stats
path: root/.gitignore
Commit message (Expand)AuthorAgeFilesLines
* update gitignoreSteffen Jaeckel2022-03-301-0/+5
* Add I/O error handling and use filenames instead of file descriptorsWilliam Wennerström2020-11-161-0/+1
* Add zipfiles to gitignoreMichael Vetter2020-02-031-0/+3
* Update gitignoreMichael Vetter2020-01-301-0/+2
* Update plugin API docsJames Booth2016-08-021-0/+1
* Update gitignore, added python API docs MakefileJames Booth2016-08-021-2/+2
* Add python plugin hook docsJames Booth2016-07-291-0/+2
* Update gitignoreJames Booth2016-07-291-2/+12
* Merge branch 'master' into python3James Booth2016-07-241-1/+0
|\
| * Update gitignoreJames Booth2016-07-241-0/+2
* | Update gitignoreJames Booth2016-07-191-0/+4
|/
* Merge remote-tracking branch 'Dav1d23/master'James Booth2016-04-111-1/+0
|\
* | Added doxygen settings for C plugin APIJames Booth2016-03-171-0/+3
|/
* Added C plugin code from plugins branchJames Booth2016-02-141-0/+2
* Updated .gitignoreJames Booth2015-08-091-0/+5
* Added codelite commands file to .gitignoreJames Booth2015-06-131-0/+1
* Moved all tests to tests folderJames Booth2015-06-121-6/+6
* Added temp config files to gitignoreJames Booth2015-06-121-0/+1
* Tidied .gitignoreJames Booth2015-06-121-57/+37
* Renamed stabbertests -> functionaltestsJames Booth2015-05-281-2/+3
* Moved tests -> unittestsJames Booth2015-05-281-0/+2
* Added more connect testsJames Booth2015-05-241-1/+2
* Added stabber testsuiteJames Booth2015-05-171-0/+1
* Added profanity.sh (OSX helper script for codelite) to .gitignoreJames Booth2015-03-041-0/+1
* Free resource lists on /account commandJames Booth2015-02-091-1/+1
* Added code to generate HTML command reference for websiteJames Booth2015-02-081-0/+3
* Added callgrind.out files to gitignoreJames Booth2015-02-061-0/+1
* Updated gitignoreJames Booth2015-01-141-0/+1
* Added chat session testsJames Booth2015-01-061-0/+1
* Added m4 directory to gitignoreJames Booth2014-10-301-0/+1
* Merge branch 'master' into muc_rolesJames Booth2014-09-301-1/+3
|\
| * Dont check for var attribute on form fields of type fixedJames Booth2014-09-301-0/+5
* | Updated gitignoreJames Booth2014-09-291-1/+1
* | Updated gitignoreJames Booth2014-09-281-0/+2
* | Added codelite project to gitignoreJames Booth2014-09-281-0/+3
|/
* Added push all script to .gitignoreJames Booth2014-05-121-0/+1
* Added cppcheck.out to .gitignoreJames Booth2014-04-261-0/+1
* Updated .gitignoreJames Booth2014-04-061-0/+4
* fixed build error when make run with -jN optionDmitry Podgorny2014-03-061-1/+2
* Added DS store to gitignoreJames Booth2014-02-121-0/+1
* Removed manual logging of test resultsJames Booth2014-02-121-1/+1
* Added push-all.sh to .gitignoreJames Booth2014-01-301-0/+1
* Move all test output to ./testsuite.out, show single line pass/failJames Booth2014-01-291-0/+1
* Added valgrind.out.old to gitignoreJames Booth2014-01-251-0/+1
* Merge branch 'master' into otrJames Booth2014-01-081-0/+1
|\
| * Added clean.sh to gitignoreJames Booth2014-01-081-0/+1
* | Merge branch 'master' into otrJames Booth2014-01-051-0/+7
|\|
| * Updated .gitignoreJames Booth2014-01-031-0/+7
* | Merge branch 'otr' of github.com:boothj5/profanity into otrJames Booth2013-11-081-0/+2
|\ \
| * | Merge branch 'master' into otrJames Booth2013-09-171-0/+1
| |\|
c637697c2ddca21ffe1'>^
df0485ae ^
79ca54b3 ^

4ca73eb6 ^
79ca54b3 ^
5b698455 ^
79ca54b3 ^



f3060715 ^
47588257 ^
0c145043 ^
47588257 ^









14a1649c ^
0c145043 ^

47588257 ^
188206bd ^
47588257 ^









188206bd ^

14a1649c ^


188206bd ^

47588257 ^
188206bd ^
47588257 ^









14a1649c ^


188206bd ^

47588257 ^
33d602db ^
47588257 ^

f7a26719 ^

47588257 ^






f7a26719 ^

47588257 ^



33d602db ^


8799371a ^
cc36784d ^
33d602db ^









8799371a ^
445a1494 ^

47588257 ^
445a1494 ^
47588257 ^

47588257 ^


f7a26719 ^
47588257 ^






f7a26719 ^
47588257 ^















445a1494 ^


8799371a ^
cc36784d ^
445a1494 ^









8799371a ^
33d602db ^
47588257 ^
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
                                       
                          


                                   
 
        
                             























                                                                                                       
                                 
                       

                          
                                     
                                                                         

                                                             
         
 
        
                                  
                                                     
                  






                                                                         
                         



                                                                          
                                                                                


                                                           
            



                                                            
                         




                                                                          
                                                                               

                                             
                                                                               

                                             
                                                                               

                                             
                                                                                




                                                                                     
                         
                             
                      

                                                                          
                                               
                                             
                                                                                



                                                                 
 
        
                            









                                                                                                                                     
                                     

                                                         
        
                               









                                                                                                                                     

                                    


                                                           

                                                                    
        
                               









                                                                                                                                     


                                                           

                                                                    
        
                         

                                                                        

                                                                                                                                                                                       






                                                                                                                                                                              

                                                                        



                                                                         


                                 
                  
                                    









                                     
                                                                 

                                                               
        
                       

                                                                        


                                                                       
                                                                                                                                                                                       






                                                                                                                                                                              
                                                                        















                                                                                      


                                 
                  
                                    









                                     
                                                               
 
        
(selective-load "mu.arc" section-level)
(set allow-raw-addresses*)
(add-code:readfile "chessboard.mu")
(freeze function*)
(load-system-functions)

(reset2)
(new-trace "read-move-legal")
(run-code main
  (default-space:space-address <- new space:literal 30:literal/capacity)
  (stdin:channel-address <- init-channel 1:literal)
  (r:integer/routine <- fork read-move:fn nil:literal/globals 2000:literal/limit stdin:channel-address)
  (c:character <- copy ((#\a literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (c:character <- copy ((#\2 literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (c:character <- copy ((#\- literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (c:character <- copy ((#\a literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (c:character <- copy ((#\4 literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (c:character <- copy ((#\newline literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (sleep until-routine-done:literal r:integer/routine)
)
(each routine completed-routines*
;?   (prn "  " routine)
  (awhen rep.routine!error
    (prn "error - " it)))
(when (~ran-to-completion 'read-move)
  (prn "F - chessboard accepts legal moves (<rank><file>-<rank><file>)"))
; todo: we can't test that keys pressed are printed to screen
; but that's at a lower level
;? (quit)

(reset2)
(new-trace "read-move-incomplete")
; initialize some variables at specific raw locations
;? (prn "== init")
(run-code test-init
  (1:channel-address/raw <- init-channel 1:literal)
  (2:terminal-address/raw <- init-fake-terminal 20:literal 10:literal)
  (3:string-address/raw <- get 2:terminal-address/raw/deref data:offset))
(wipe completed-routines*)
; the component under test; we'll be running this repeatedly
(let read-move-routine (make-routine 'read-move memory*.1 memory*.2)
;?   (prn "== first key")
  (run-code send-first-key
    (default-space:space-address <- new space:literal 30:literal/capacity)
    (c:character <- copy ((#\a literal)))
    (x:tagged-value <- save-type c:character)
    (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value))
  (wipe completed-routines*)
  ; check that read-move consumes it and then goes to sleep
  (enq read-move-routine running-routines*)
  (run-more)
  (when (ran-to-completion 'read-move)
    (prn "F - chessboard waits after first letter of move"))
  (wipe completed-routines*)
  ; send in a few more letters
;?   (prn "== more keys")
  (restart read-move-routine)
  (run-code send-more-keys
    (default-space:space-address <- new space:literal 30:literal/capacity)
    (c:character <- copy ((#\2 literal)))
    (x:tagged-value <- save-type c:character)
    (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
    (c:character <- copy ((#\- literal)))
    (x:tagged-value <- save-type c:character)
    (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
    (c:character <- copy ((#\a literal)))
    (x:tagged-value <- save-type c:character)
    (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
    (c:character <- copy ((#\4 literal)))
    (x:tagged-value <- save-type c:character)
    (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value))
  ; check that read-move consumes them and then goes to sleep
  (when (ran-to-completion 'read-move)
    (prn "F - chessboard waits after each subsequent letter of move until the last"))
  (wipe completed-routines*)
  ; send final key
;?   (prn "== final key")
  (restart read-move-routine)
;?   (set dump-trace*)
  (run-code send-final-key
    (default-space:space-address <- new space:literal 30:literal/capacity)
    (c:character <- copy ((#\newline literal)))
    (x:tagged-value <- save-type c:character)
    (1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value))
  ; check that read-move consumes it and -- this time -- returns
  (when (~ran-to-completion 'read-move)
    (prn "F - 'read-move' completes after final letter of move"))
)

(reset2)
(new-trace "read-move-quit")
(run-code main
  (default-space:space-address <- new space:literal 30:literal/capacity)
  (stdin:channel-address <- init-channel 1:literal)
  (dummy:terminal-address <- init-fake-terminal 20:literal 10:literal)
  (r:integer/routine <- fork-helper read-move:fn nil:literal/globals 2000:literal/limit stdin:channel-address dummy:terminal-address)
  (c:character <- copy ((#\q literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (sleep until-routine-done:literal r:integer/routine)
)
(when (~ran-to-completion 'read-move)
  (prn "F - chessboard quits on move starting with 'q'"))

(reset2)
(new-trace "read-illegal-file")
(run-code main
  (default-space:space-address <- new space:literal 30:literal/capacity)
  (stdin:channel-address <- init-channel 1:literal)
  (dummy:terminal-address <- init-fake-terminal 20:literal 10:literal)
  (r:integer/routine <- fork-helper read-file:fn nil:literal/globals 2000:literal/limit stdin:channel-address dummy:terminal-address)
  (c:character <- copy ((#\i literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (sleep until-routine-done:literal r:integer/routine)
)
;? (each routine completed-routines*
;?   (prn "  " routine))
(when (or (ran-to-completion 'read-file)
          (let routine routine-running!read-file
            (~posmatch "file too high" rep.routine!error)))
  (prn "F - 'read-file' checks that file lies between 'a' and 'h'"))

(reset2)
(new-trace "read-illegal-rank")
(run-code main
  (default-space:space-address <- new space:literal 30:literal/capacity)
  (stdin:channel-address <- init-channel 1:literal)
  (dummy:terminal-address <- init-fake-terminal 20:literal 10:literal)
  (r:integer/routine <- fork-helper read-rank:fn nil:literal/globals 2000:literal/limit stdin:channel-address dummy:terminal-address)
  (c:character <- copy ((#\9 literal)))
  (x:tagged-value <- save-type c:character)
  (stdin:channel-address/deref <- write stdin:channel-address x:tagged-value)
  (sleep until-routine-done:literal r:integer/routine)
)
(when (or (ran-to-completion 'read-rank)
          (let routine routine-running!read-rank
            (~posmatch "rank too high" rep.routine!error)))
  (prn "F - 'read-rank' checks that rank lies between '1' and '8'"))

(reset2)
(new-trace "print-board")
(run-code main
  (default-space:space-address <- new space:literal 30:literal/capacity)
;?   ($print (("init-array\n" literal))) ;? 1
  (initial-position:integer-array-address <- init-array ((#\R literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\r literal))
                                              ((#\N literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\n literal))
                                              ((#\B literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\b literal))
                                              ((#\Q literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\q literal))
                                              ((#\K literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\k literal))
                                              ((#\B literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\b literal))
                                              ((#\N literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\n literal))
                                              ((#\R literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\r literal)))
;?   ($print (("init-board\n" literal))) ;? 1
  (b:board-address <- init-board initial-position:integer-array-address)
  (screen:terminal-address <- init-fake-terminal 20:literal 10:literal)
  (print-board screen:terminal-address b:board-address)
  (1:string-address/raw <- get screen:terminal-address/deref data:offset)
)
(each routine completed-routines*
  (awhen rep.routine!error
    (prn "error - " it)))
;? (prn memory*.1)
(when (~screen-contains memory*.1 20
          (+ "8 | r n b q k b n r "
             "7 | p p p p p p p p "
             "6 | _ _ _ _ _ _ _ _ "
             "5 | _ _ _ _ _ _ _ _ "
             "4 | _ _ _ _ _ _ _ _ "
             "3 | _ _ _ _ _ _ _ _ "
             "2 | P P P P P P P P "
             "1 | R N B Q K B N R "
             "  +---------------- "
             "    a b c d e f g h "))
  (prn "F - print-board works; chessboard begins at @memory*.1"))

; todo: how to fold this more elegantly with the previous test?
(reset2)
(new-trace "make-move")
(run-code main
  (default-space:space-address <- new space:literal 30:literal/capacity)
  ; fake screen
  (screen:terminal-address <- init-fake-terminal 20:literal 10:literal)
  ; initial position
  (initial-position:integer-array-address <- init-array ((#\R literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\r literal))
                                              ((#\N literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\n literal))
                                              ((#\B literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\b literal))
                                              ((#\Q literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\q literal))
                                              ((#\K literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\k literal))
                                              ((#\B literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\b literal))
                                              ((#\N literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\n literal))
                                              ((#\R literal)) ((#\P literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\_ literal)) ((#\p literal)) ((#\r literal)))
  (b:board-address <- init-board initial-position:integer-array-address)
  ; move: a2-a4
  (m:move-address <- new move:literal)
  (f:integer-integer-pair-address <- get-address m:move-address/deref from:offset)
  (dest:integer-address <- get-address f:integer-integer-pair-address/deref 0:offset)
  (dest:integer-address/deref <- copy 0:literal)  ; from-file: a
  (dest:integer-address <- get-address f:integer-integer-pair-address/deref 1:offset)
  (dest:integer-address/deref <- copy 1:literal)  ; from-rank: 2
  (t0:integer-integer-pair-address <- get-address m:move-address/deref to:offset)
  (dest:integer-address <- get-address t0:integer-integer-pair-address/deref 0:offset)
  (dest:integer-address/deref <- copy 0:literal)  ; to-file: a
  (dest:integer-address <- get-address t0:integer-integer-pair-address/deref 1:offset)
  (dest:integer-address/deref <- copy 3:literal)  ; to-rank: 4
  (b:board-address <- make-move b:board-address m:move-address)
  (print-board screen:terminal-address b:board-address)
  (1:string-address/raw <- get screen:terminal-address/deref data:offset)
)
(each routine completed-routines*
  (awhen rep.routine!error
    (prn "error - " it)))
;? (prn memory*.1)
(when (~screen-contains memory*.1 20
          (+ "8 | r n b q k b n r "
             "7 | p p p p p p p p "
             "6 | _ _ _ _ _ _ _ _ "
             "5 | _ _ _ _ _ _ _ _ "
             "4 | P _ _ _ _ _ _ _ "
             "3 | _ _ _ _ _ _ _ _ "
             "2 | _ P P P P P P P "
             "1 | R N B Q K B N R "
             "  +---------------- "
             "    a b c d e f g h "))
  (prn "F - make-move works; chessboard begins at @memory*.1"))

(reset2)