testing scripts
This commit is contained in:
3
test.nu
Executable file
3
test.nu
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env nu
|
||||
cmake --build build
|
||||
ls testing/tests -s | get name | each {./util.nu $in} | to text
|
||||
20
util.nu
Executable file
20
util.nu
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
# Usage: ./util.nu 0-go.txt
|
||||
|
||||
def main [testfile: string] {
|
||||
let test_path = $"testing/tests/($testfile)"
|
||||
let expected_path = $"testing/expected/($testfile)"
|
||||
let exec = "./build/ps1"
|
||||
|
||||
# Run program and capture output
|
||||
let actual = (open $test_path | ^$exec | str trim)
|
||||
let expected = (open $expected_path | str trim)
|
||||
|
||||
# Compare outputs
|
||||
if $actual == $expected {
|
||||
print $"✓ ($testfile) passed"
|
||||
} else {
|
||||
print $"✗ ($testfile) failed"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user