test(c12): add sparse-matrix triples and multiply fixture

- Fixture 73 implements triple-list lookup, dense conversion and sparse
  multiply with Int arithmetic and exact indexing.
- Include it in the P2 pure closure lane and update golden count to 73,
  C12 evidence mapping, status/README/changelog.

Gate: fmt, clippy -D warnings, 430 tests passed.
This commit is contained in:
cflmy committed 2026-11-20 23:19:45 +08:00
1 parent 3484ab944c
commit 8bbed34bd3
8 files changed
+187 -5

No files matched your search

+2
View File
@@ -130,6 +130,8 @@ currently `0.1.0`; no release tag has been cut. Dates use ISO 8601.
- CM-A10 offline packaging: `tools/pack-stdlib.py` emits a deterministic
`marqdo-stdlib-0.1.0.tar.gz` plus tree/archive digests and a file manifest;
the archive is for the future external repository, not the CLI loader.
- C12 sparse matrix: fixture 73 adds triple-list sparse multiply and dense
conversion, included in the P2 pure closure lane.
- P6 baseline profile: add `tools/perf/bench.py` and a checked-in 7-workload
JSON report; no bytecode/JIT/native backend is introduced.
- P4 cross-storage table equivalence: fixture 72 compares row-store Table
+1 -1
View File
@@ -81,7 +81,7 @@ executes anything.
## What works (implemented and tested)
* **P0 contracts** — frozen Markdown profile, AST → program mapping, strict
expression grammar, evaluation semantics; 160 AST goldens, 72 semantic
expression grammar, evaluation semantics; 160 AST goldens, 73 semantic
goldens, 52 compile-error fixtures and 21 runtime-error fixtures
(`tests/`).
* **P1 interpreter** — native Rust tree-walk interpreter: values, scopes,
+1
View File
@@ -58,6 +58,7 @@ fn p2_algorithms_run_in_a_pure_no_foreign_no_plugin_host() {
("69-table-group-stdlib.mq.md", "C06 table group"),
("63-memory-bytecode-vm.mq.md", "C11 bytecode VM"),
("70-matrix-multiply.mq.md", "C12 matrix"),
("73-sparse-matrix.mq.md", "C12 sparse matrix"),
];
for (name, criterion) in cases {
let path = fixture(name);
+2 -2
View File
@@ -72,7 +72,7 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
| 2 | Cross-platform strict `cfg` | **Fixed locally; native CI UNVERIFIED** | `#[cfg]` dispatch + non-Linux regression test |
| 3 | Strict probe→launch race | **Fixed locally; GitHub Linux CI UNVERIFIED** | fail-closed CLI contract + probe-OK/launch-EAGAIN seam test |
| 4 | Parallel security matrix isolation | **Fixed** | unique paths + helper `OnceLock`; 7/7 in parallel workspace run |
| 5 | Markdown/power/control-flow corpus | **Done locally** | 160 AST, 72 semantic, 52 compile-negative, 21 runtime-negative fixtures |
| 5 | Markdown/power/control-flow corpus | **Done locally** | 160 AST, 73 semantic, 52 compile-negative, 21 runtime-negative fixtures |
| 6 | Condition header + source spans | **Fixed** | executable tails rejected; literal-inside-backtick mapping tests |
| 7 | Independent Tool consumers | **Done locally** | `sample-view`/`sample-knowledge`/`sample-proof` E2E test |
| 8 | lock v3 reproducibility | **Implemented; tamper test added** | `package_env` PASS |
@@ -87,7 +87,7 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
- Frozen Markdown profile `marqdo.md.v1` with 160 AST goldens and explicit
CRLF byte semantics.
- Native Rust interpreter with 72 semantic goldens, 52 compile-error fixtures,
- Native Rust interpreter with 73 semantic goldens, 52 compile-error fixtures,
and runtime error source attribution.
- Native `**` power is pinned end-to-end: right associativity, unary-minus
precedence, parentheses, float negative exponents, branch/loop conditions,
+1 -1
View File
@@ -39,7 +39,7 @@ fixture.
| C05 JSON/CSV | 57, 62, 68 | CSV split/quoting, recursive JSON parse/format/errors |
| C06 GFM Table | 53, 54, 65, 67, 69 + stdlib table | projection/filter/sort/join/group/GFM render, no Rust table algorithm |
| C11 VM | 63 | Memory-backed stack bytecode VM |
| C12 scientific prep | 70 | Int matrix multiply with exact indexing |
| C12 scientific prep | 70, 73 | Int matrix multiply and sparse-triple matrix multiply with dense conversion |
No fixture compiles Rust, imports a package, invokes a foreign kernel or calls a
plugin. Dynamic arrays are built at runtime; no fixed-length source rewrite is
+1 -1
View File
@@ -15,7 +15,7 @@ no test commits, copies or rewrites files outside a throw-away temp directory.
tests/
├── conformance/
│ ├── ast/ 160 × *.mq.md + sibling *.ast.json goldens
│ └── semantics/ 72 × *.mq.md + sibling *.expected.json goldens
│ └── semantics/ 73 × *.mq.md + sibling *.expected.json goldens
├── negative/
│ ├── *.mq.md 52 × compile-time hard-error fixtures + *.expected.json
│ ├── warnings/ 6 × inert-executable warning fixtures + *.expected.json
@@ -0,0 +1,80 @@
{
"args": {},
"function": "main",
"stdout": "",
"value": {
"items": [
{
"items": [
{
"items": [
{
"decimal": "0",
"type": "int"
},
{
"decimal": "0",
"type": "int"
},
{
"decimal": "16",
"type": "int"
}
],
"type": "list"
},
{
"items": [
{
"decimal": "1",
"type": "int"
},
{
"decimal": "1",
"type": "int"
},
{
"decimal": "15",
"type": "int"
}
],
"type": "list"
}
],
"type": "list"
},
{
"items": [
{
"items": [
{
"decimal": "16",
"type": "int"
},
{
"decimal": "0",
"type": "int"
}
],
"type": "list"
},
{
"items": [
{
"decimal": "0",
"type": "int"
},
{
"decimal": "15",
"type": "int"
}
],
"type": "list"
}
],
"type": "list"
}
],
"type": "list"
}
}
@@ -0,0 +1,99 @@
## 查值
`(三元组, 行, 列)`
**值 = 0**
**下标 = 0**
- `下标 < 长度(三元组)`
1. `三元组[下标][0] == 行 and 三元组[下标][1] == 列`
**值 = 三元组[下标][2]**
2. `true`
**忽略 = 0**
**下标 = 下标 + 1**
*值*
## 三列转稠密
`(三元组, 行数, 列数)`
**矩阵 = []**
**行号 = 0**
- `行号 < 行数`
**行 = []**
**列号 = 0**
- `列号 < 列数`
**行 = list.append(行, 查值(三元组, 行号, 列号))**
**列号 = 列号 + 1**
**矩阵 = list.append(矩阵, 行)**
**行号 = 行号 + 1**
*矩阵*
## 稀疏乘法
`(左, 右, 行数, 内维, 列数)`
**结果 = []**
**行号 = 0**
- `行号 < 行数`
**列号 = 0**
- `列号 < 列数`
**和 = 0**
**内号 = 0**
- `内号 < 内维`
**左值 = 查值(左, 行号, 内号)**
**右值 = 查值(右, 内号, 列号)**
**和 = 和 + 左值 * 右值**
**内号 = 内号 + 1**
1. `和 != 0`
**结果 = list.append(结果, [行号, 列号, 和])**
2. `true`
**忽略 = 0**
**列号 = 列号 + 1**
**行号 = 行号 + 1**
*结果*
## main
**左 = [[0, 0, 1], [0, 2, 2], [1, 1, 3]]**
**右 = [[0, 0, 4], [1, 1, 5], [2, 0, 6]]**
**乘积 = 稀疏乘法(左, 右, 2, 3, 2)**
*[乘积, 三列转稠密(乘积, 2, 2)]*