unittests Reference
Script defined in `lua/console/unittests.lua`. Unit tests for vec3 math operations including correctness and performance validation.
Script defined in lua/console/unittests.lua. Unit tests for vec3 math operations including correctness and performance validation.
Functions/Exports
test_vec3_function() (global)
Tests vec3 constructor, floating point representation, and arithmetic operators:
- Constructor:
vec3(0,0,0)→"(0, 0, 0)" - Float precision: various float values and precision limits
- Operators:
+,-,*,/, unary- - Equality:
==and~= - Uses
assert()- fails fast on any test failure
test_vec3_performance() (global)
Runs 100,000 iterations of vec3 arithmetic operations and checks total time stays under 850ms. Logs a warning if too slow.
Usage
rerequire("lua/console/unittests")
-- Tests auto-execute on loadInternal Notes
- Requires
mathlibfor vec3 implementation - JIT on/off toggle is commented out (can test JIT impact on vec3 perf)
- Performance threshold: 850ms for 100k iterations of add/sub/mul/div
- Auto-executes both tests on load
- Loaded by
servertests.luaas the main test suite
test Reference
Script defined in `lua/console/test.lua`. Main development test file with vehicle loading and JSON parsing test functions.
`be` - BeamNG Engine Binding
Core C++ engine binding available globally in GE Lua. Provides direct access to vehicles, physics state, object management, time control, and world queries.