nx_https_post_complete_test.nx source
↩ module page · 37 lines · 1462 B
1// nx_https_post_complete_test.nx -- compile + symbol-resolution gate.
2//
3// This module is offline-only -- a live LE-staging round-trip requires
4// a real TLS session at CONNECTED state plus a Mozilla trust store
5// loaded from /tmp/mozilla_certdata.txt. Both belong to the
6// queued nx_acme_directory_live_smoke arc.
7//
8// What this test DOES assert:
9// - nx_https_post_complete + its imports compile clean
10// - the verdict-validity predicate matches the sealed enum
11// - nx_http_client_build_request_post emits the expected wire bytes
12// for a representative POST (delegated to the dedicated KAT in
13// nx_http_client_post_test.nx so we don't re-verify here)
14//
15// What this test DOES NOT assert:
16// - any TLS round-trip (no socket, no trust store)
17// - end-to-end LE staging POST (separate live test)
18
19import "nx_syscalls.nx"
20import "nx_https_post_complete.nx"
21
22func main() -> i64 {
23 // Predicate happy path.
24 if nx_https_pc_verdict_is_valid(NX_HTTPS_PC_OK) != 1 { return 1 }
25 if nx_https_pc_verdict_is_valid(NX_HTTPS_PC_BODY_TOO_BIG) != 1 { return 2 }
26 if nx_https_pc_verdict_is_valid(NX_HTTPS_PC_VERDICT_N) != 0 { return 3 }
27 if nx_https_pc_verdict_is_valid(0 - 1) != 0 { return 4 }
28
29 // Sealed-enum size matches the declared count.
30 if NX_HTTPS_PC_VERDICT_N != 10 { return 5 }
31
32 // "PASS\n"
33 let ok: *u8 = sys_mmap(8)
34 ok[0]=80; ok[1]=65; ok[2]=83; ok[3]=83; ok[4]=10
35 sys_write(1, ok, 5)
36 return 0
37}