nx_gtm_build_test.nx source
↩ module page · 28 lines · 1264 B
1// nx_gtm_build_test.nx -- smoke for nx_gtm_build. Proves step durations,
2// precedence, the critical-path schedule (min build time with parallel
3// hands), and the parallel time-saving. Exit code = failed assertion #.
4
5import "nx_syscalls.nx"
6import "nx_gtm_build.nx"
7
8func main() -> i64 {
9 if gb_count() != 10 { return 1 }
10 if gb_duration(GB_PRINT_ENCLOSURE) != 240 { return 2 } // the long pole
11
12 // --- serial vs parallel ---
13 if gb_total_time() != 520 { return 3 } // all steps serially
14 if gb_critical_path() != 350 { return 4 } // min time with parallel hands
15 if gb_parallel_savings() != 170 { return 5 } // 520 - 350
16
17 // --- earliest-finish through the DAG ---
18 if gb_earliest_finish(GB_MINERAL) != 80 { return 6 } // collection->treat->mineral chain
19 if gb_earliest_finish(GB_INTEGRATE) != 300 { return 7 } // gated by the enclosure print (240)
20 if gb_earliest_finish(GB_POWER_ON_TEST) != 350 { return 8 }
21
22 // --- precedence ---
23 if gb_prereq(GB_INTEGRATE, 0) != GB_PRINT_ENCLOSURE { return 9 }
24 if gb_prereq(GB_INTEGRATE, 3) != GB_WIRE_CONTROL { return 10 }
25 if gb_prereq(GB_PRINT_ENCLOSURE, 0) != 0 - 1 { return 11 } // no prerequisites
26
27 return 0
28}