Native Test Runner (`spc test`)
SP enables unit and integration testing without external dependencies through embedded test "name" { ... } blocks.
math_test.sp
1import std.math;23test "Verify Square Root Calculation" {4 let result = math.sqrt(100.0);5 assert(result == 10.0, "Expected sqrt(100) to equal 10");6}78test "Verify Power Function" {9 let p = math.pow(2.0, 3.0);10 assert(p == 8.0, "Expected 2^3 == 8");11}
Running Tests
bash
1# Run all tests in the current directory and subdirectories2spc test34# Run tests matching a regex filter5spc test --filter "Square Root"67# Verbose execution with assertion logs8spc test -v