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;
2
3test "Verify Square Root Calculation" {
4 let result = math.sqrt(100.0);
5 assert(result == 10.0, "Expected sqrt(100) to equal 10");
6}
7
8test "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 subdirectories
2spc test
3
4# Run tests matching a regex filter
5spc test --filter "Square Root"
6
7# Verbose execution with assertion logs
8spc test -v