nx_outfit_vocabulary_test.nx source
↩ module page · 76 lines · 3115 B
1import "nx_syscalls.nx"
2import "nx_outfit_vocabulary.nx"
3
4func main() -> i64 {
5 // T1: English variant for MICRO_STRING_THONG exists.
6 let en: *u8 = nx_outfit_phrase(NX_OUTFIT_MICRO_STRING_THONG, NX_LANG_EN, 0)
7 if en == (0 as *u8) { return 1 }
8 let en_len: i64 = nx_outfit_strlen(en)
9 if en_len < 10 { return 2 }
10 // Should start with 'm' for "micro"
11 if en[0] != 109 { return 3 } // 'm' = 109
12
13 // T2: Japanese variant 0 for MICRO_STRING_THONG = "ヒモパン"
14 // ヒモパン in UTF-8: ヒ=E3 83 92 モ=E3 83 A2 パ=E3 83 91 ン=E3 83 B3 → 12 bytes
15 let ja: *u8 = nx_outfit_phrase(NX_OUTFIT_MICRO_STRING_THONG, NX_LANG_JA, 0)
16 if ja == (0 as *u8) { return 10 }
17 let ja_len: i64 = nx_outfit_strlen(ja)
18 if ja_len != 12 { return 11 }
19 if ja[0] != 0xe3 { return 12 }
20 if ja[1] != 0x83 { return 13 }
21
22 // T3: Japanese variant 1 = "紐パンティ" — different bytes
23 let ja1: *u8 = nx_outfit_phrase(NX_OUTFIT_MICRO_STRING_THONG, NX_LANG_JA, 1)
24 if ja1 == (0 as *u8) { return 20 }
25 let ja1_b0: i64 = ja1[0]
26 let ja1_b1: i64 = ja1[1]
27 let ja1_b2: i64 = ja1[2]
28 // 紐 in UTF-8 = E7 B4 90
29 if ja1_b0 != 0xe7 { return 21 }
30 if ja1_b1 != 0xb4 { return 22 }
31 if ja1_b2 != 0x90 { return 23 }
32
33 // T4: Korean variant = "끈팬티" — distinct bytes
34 let ko: *u8 = nx_outfit_phrase(NX_OUTFIT_MICRO_STRING_THONG, NX_LANG_KO, 0)
35 if ko == (0 as *u8) { return 30 }
36 // 끈 in UTF-8 = EB 81 88
37 if ko[0] != 0xeb { return 31 }
38
39 // T5: Chinese variant = "细绳丁字裤"
40 let zh: *u8 = nx_outfit_phrase(NX_OUTFIT_MICRO_STRING_THONG, NX_LANG_ZH_CN, 0)
41 if zh == (0 as *u8) { return 40 }
42 // 细 in UTF-8 = E7 BB 86
43 if zh[0] != 0xe7 { return 41 }
44 if zh[1] != 0xbb { return 42 }
45
46 // T6: Unknown outfit returns 0 pointer.
47 let none: *u8 = nx_outfit_phrase(NX_OUTFIT_UNKNOWN, NX_LANG_EN, 0)
48 if none != (0 as *u8) { return 50 }
49
50 // T7: Multi-language composer writes all variants concatenated.
51 let buf: *u8 = sys_mmap(2048)
52 let n: i64 = nx_outfit_compose_multilang(NX_OUTFIT_MICRO_STRING_THONG, buf, 2048)
53 if n < 50 { return 60 } // should be substantial
54 if buf[0] != 109 { return 61 } // starts with 'm' (English first)
55 // Verify the composed prompt contains both English and Japanese byte
56 // sequences (search for ヒ byte sequence in the output).
57 var found_ja: i64 = 0
58 var i: i64 = 0
59 while i < n - 2 {
60 if buf[i] == 0xe3 { if buf[i + 1] == 0x83 { if buf[i + 2] == 0x92 { found_ja = 1 } } }
61 i = i + 1
62 }
63 if found_ja != 1 { return 70 }
64
65 // T8: T_BACK_THONG ja = "Tバック" → starts with 'T' (0x54) then バ
66 let tback: *u8 = nx_outfit_phrase(NX_OUTFIT_T_BACK_THONG, NX_LANG_JA, 0)
67 if tback == (0 as *u8) { return 80 }
68 if tback[0] != 0x54 { return 81 } // 'T'
69 if tback[1] != 0xe3 { return 82 } // バ first byte
70
71 // T9: BODYCON_DRESS_TIGHT JA = "ボディコンドレス"
72 let bc: *u8 = nx_outfit_phrase(NX_OUTFIT_BODYCON_DRESS_TIGHT, NX_LANG_JA, 0)
73 if bc == (0 as *u8) { return 90 }
74
75 return 0
76}