Notebook Tests
Unit tests for notebook structured data serialization and deserialization. Validates that structured pacenote fields survive round-trip save/load.
Unit tests for notebook structured data serialization and deserialization. Validates that structured pacenote fields survive round-trip save/load.
Extension Name
gameplay_notebook_test_testNotebook
Usage
-- Run from game Lua console:
extensions.unload("gameplay_notebook_test_testNotebook")
extensions.load("gameplay_notebook_test_testNotebook")
gameplay_notebook_test_testNotebook.testAll()Exports
| Function | Signature | Description |
|---|---|---|
M.testAll | () | Runs all notebook tests |
Test Cases
testStructured_deserialize
Loads a test notebook (test_v3_1.notebook.json) and verifies that corner_degrees is -42 on the first pacenote's structured fields.
testStructured_serialize
- Loads the test notebook
- Modifies
corner_degreesto55on the first pacenote - Saves to an output file
- Re-loads the original file - verifies it still has
-42(not mutated) - Re-loads the output file - verifies it has
55(properly saved)
Internals
Test Infrastructure
-- Simple assertEqual with pass/fail counting
local assertCounts = { total = 0, passed = 0, failed = 0 }
local function assertEqual(message, actual, expected)
-- Increments counters, logs pass/fail, errors on failure
endNotebook Loading
local function loadNotebook(notebookFname)
local json = jsonReadFile(notebookFname)
local notebook = require('/lua/ge/extensions/gameplay/rally/notebook/path')()
notebook:setFname(notebookFname)
notebook:onDeserialized(json)
return notebook
endTest Data Files
- Input:
/gameplay/missions/driver_training/rallyStage/aip-test3/rally/notebooks/test_v3_1.notebook.json - Output:
/gameplay/missions/driver_training/rallyStage/aip-test3/rally/notebooks/test_v3_1_out.notebook.json
See Also
- Gameplay Systems Guide - Guide
Visual Compositor
Generates visual pacenote icon data for the HUD display. Converts structured pacenote attributes (corner severity, modifiers, cautions) into icon descriptions consumed by the CEF UI layer.
Cuts Recording
Loads recce cut recordings and their associated speech-to-text transcripts from JSONL files. Cuts are waypoint markers where the co-driver made voice recordings during reconnaissance.