Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Test-a-function/Jq/test-a-function-1.jq
Normal file
19
Task/Test-a-function/Jq/test-a-function-1.jq
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Test case 1:
|
||||
.
|
||||
1
|
||||
1
|
||||
|
||||
# Test case 2:
|
||||
1+1
|
||||
null
|
||||
2
|
||||
|
||||
# Test case 3 (with the wrong result):
|
||||
1+1
|
||||
null
|
||||
0
|
||||
|
||||
# A test case with a function definition:
|
||||
def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end; factorial
|
||||
3
|
||||
6
|
||||
8
Task/Test-a-function/Jq/test-a-function-2.jq
Normal file
8
Task/Test-a-function/Jq/test-a-function-2.jq
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
$ jq --run-tests < jq.tests
|
||||
|
||||
Testing '.' at line number 3
|
||||
Testing '1+1' at line number 8
|
||||
Testing '1+1' at line number 13
|
||||
*** Expected 0, but got 2 for test at line number 15: 1+1
|
||||
Testing 'def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end; factorial' at line number 18
|
||||
3 of 4 tests passed (0 malformed)
|
||||
3
Task/Test-a-function/Jq/test-a-function-3.jq
Normal file
3
Task/Test-a-function/Jq/test-a-function-3.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end;
|
||||
|
||||
def palindrome: explode as $in | ($in|reverse) == $in;
|
||||
7
Task/Test-a-function/Jq/test-a-function-4.jq
Normal file
7
Task/Test-a-function/Jq/test-a-function-4.jq
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import "library" as lib; lib::factorial
|
||||
3
|
||||
6
|
||||
|
||||
import "library" as lib; lib::palindrome
|
||||
"salàlas"
|
||||
true
|
||||
1
Task/Test-a-function/Jq/test-a-function-5.jq
Normal file
1
Task/Test-a-function/Jq/test-a-function-5.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
jq --run-tests < test-library.txt
|
||||
Loading…
Add table
Add a link
Reference in a new issue