code wiki / (root) / nx_moonraker_client_test.nx

nx_moonraker_client_test.nx

buildroot/runtime/nx_moonraker_client_test.nx

5135 B132 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic moonraker
docsdependenciesstructsconstsfunctions

about

nx_moonraker_client_test.nx -- verify URL building + JSON body + HTTP request assembly + status parsing against known-byte expected outputs. Closed-form invariants (every byte hand-verified): (a) Filename validation: "test.gcode" safe; quotes/backslash refused. (b) URL build: base "http://10.0.0.5:7125" + path "/printer/info" -> "http://10.0.0.5:7125/printer/info" (33 bytes). (c) JSON print-start body for "voron.gcode" -> (28 bytes including the {} and quotes). (d) POST request bytes start with "POST /printer/print/start HTTP/1.1\r\n" contain "Host: 10.0.0.5:7125\r\n", contain "Content-Type: application/json\r\n", contain "Content-Length: 28\r\n\r\n", and end with the JSON body. (e) GET request bytes start with "GET /printer/info HTTP/1.1\r\n". (f) GET request with API key contains "X-Api-Key: secret\r\n". (g) Status-line parser: "HTTP/1.1 200 OK\r\n" -> 200. (h) Status-line parser: "HTTP/1.1 503 Service" -> 503. (i) Status-line parser malformed: "HTTPx/1.1 200 OK" -> -1. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_moonraker_client.nx nx_moonraker_client_test.nx

imports: nx_syscalls.nxnx_moonraker_client.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_mr_filename_is_safe nx_mr_build_print_start_bo nx_mr_filename_is_safe ↻ nx_mr_write_cstr nx_mr_write_bytes smoke_buf_eq nx_mr_build_post_request nx_mr_write_cstr ↻ nx_mr_write_bytes ↻ nx_mr_write_int smoke_contains nx_mr_build_get_request nx_mr_write_cstr ↻ nx_mr_write_bytes ↻ nx_mr_parse_status

structs

none

consts

none

functions

31func smoke_buf_eq(buf: *u8, expected: *u8, n: i64) -> i64
called by 1: main
40func smoke_contains(buf: *u8, len: i64, needle: *u8) -> i64
called by 1: main
58func cstr_len(s: *u8) -> i64
64func main() -> i64