Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
38
Task/Test-a-function/AutoHotkey/test-a-function-1.ahk
Normal file
38
Task/Test-a-function/AutoHotkey/test-a-function-1.ahk
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
; assert.ahk
|
||||
;; assert(a, b, test=2)
|
||||
assert(a, b="blank", test=0)
|
||||
{
|
||||
if (b = "blank")
|
||||
{
|
||||
if !a
|
||||
msgbox % "blank value"
|
||||
return 0
|
||||
}
|
||||
if equal_list(a, b, "`n")
|
||||
return 0
|
||||
else
|
||||
msgbox % test . ":`n" . a . "`nexpected:`n" . b
|
||||
}
|
||||
|
||||
!r::reload
|
||||
|
||||
;; equal_list(a, b, delimiter)
|
||||
equal_list(a, b, delimiter)
|
||||
{
|
||||
loop, parse, b, %delimiter%
|
||||
{
|
||||
if instr(a, A_LoopField)
|
||||
continue
|
||||
else
|
||||
return 0
|
||||
}
|
||||
loop, parse, a, %delimiter%
|
||||
{
|
||||
if instr(b, A_LoopField)
|
||||
continue
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
21
Task/Test-a-function/AutoHotkey/test-a-function-2.ahk
Normal file
21
Task/Test-a-function/AutoHotkey/test-a-function-2.ahk
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
assert(isPalindrome("in girum imus nocte et consumimur igni"), 1
|
||||
, "palindrome test")
|
||||
assert(broken("in girum imus nocte et consumimur igni"), "works"
|
||||
, "broken test")
|
||||
/*
|
||||
output:
|
||||
---------------------------
|
||||
testPalindrome.ahk
|
||||
---------------------------
|
||||
broken test:
|
||||
broken
|
||||
expected:
|
||||
works
|
||||
*/
|
||||
|
||||
broken(x){
|
||||
return "broken"
|
||||
}
|
||||
|
||||
#Include assert.ahk
|
||||
#Include palindrome.ahk
|
||||
Loading…
Add table
Add a link
Reference in a new issue