nx_concept_test.nx source
↩ module page · 55 lines · 2444 B
1// nx_concept_test.nx -- smoke for typed concept dictionary.
2//
3// Tests that each registered concept ID resolves to the correct
4// sealed ontology, and unknown IDs are typed UNKNOWN (not silently
5// approximated).
6
7import "nx_syscalls.nx"
8import "nx_concept.nx"
9
10func main() -> i64 {
11 let ref: *ConceptRef = (sys_mmap(32)) as *ConceptRef
12
13 // T1: retroussé (FR) -> ANATOMICAL_SHAPE
14 nx_concept_ref_init(ref, NX_CONCEPT_RETROUSSE, 1024)
15 if ref.concept_id != NX_CONCEPT_RETROUSSE { return 1 }
16 if ref.ontology != NX_ONTOLOGY_ANATOMICAL_SHAPE { return 2 }
17 if ref.fidelity_q10 != 1024 { return 3 }
18 if nx_concept_ref_is_valid(ref) != 1 { return 4 }
19
20 // T2: pendulous -> ANATOMICAL_SHAPE (same category as retroussé)
21 nx_concept_ref_init(ref, NX_CONCEPT_PENDULOUS, 768)
22 if ref.ontology != NX_ONTOLOGY_ANATOMICAL_SHAPE { return 10 }
23 if ref.fidelity_q10 != 768 { return 11 }
24
25 // T3: Elara_class (proper noun) -> IDENTITY_REF
26 nx_concept_ref_init(ref, NX_CONCEPT_ELARA_CLASS, 512)
27 if ref.ontology != NX_ONTOLOGY_IDENTITY_REF { return 20 }
28
29 // T4: Mike_Dowson_style -> STYLE_SIGNATURE
30 nx_concept_ref_init(ref, NX_CONCEPT_MIKE_DOWSON_STYLE, 256)
31 if ref.ontology != NX_ONTOLOGY_STYLE_SIGNATURE { return 30 }
32
33 // T5: face_fusion -> TECHNICAL_ARTIFACT
34 nx_concept_ref_init(ref, NX_CONCEPT_FACE_FUSION, 1024)
35 if ref.ontology != NX_ONTOLOGY_TECHNICAL_ARTIFACT { return 40 }
36
37 // T6: photographic_clarity -> TECHNICAL_FLAG
38 nx_concept_ref_init(ref, NX_CONCEPT_PHOTOGRAPHIC_CLARITY, 1024)
39 if ref.ontology != NX_ONTOLOGY_TECHNICAL_FLAG { return 50 }
40
41 // T7: skin_realism -> AESTHETIC_QUALITY
42 nx_concept_ref_init(ref, NX_CONCEPT_SKIN_REALISM, 800)
43 if ref.ontology != NX_ONTOLOGY_AESTHETIC_QUALITY { return 60 }
44
45 // T8: unknown ID -> UNKNOWN, ref not valid
46 nx_concept_ref_init(ref, 999, 0)
47 if ref.ontology != NX_ONTOLOGY_UNKNOWN { return 70 }
48 if nx_concept_ref_is_valid(ref) != 0 { return 71 }
49
50 // T9: emotion_congruence (latest added, id 36) -> AESTHETIC_QUALITY
51 nx_concept_ref_init(ref, NX_CONCEPT_EMOTION_CONGRUENCE, 1024)
52 if ref.ontology != NX_ONTOLOGY_AESTHETIC_QUALITY { return 80 }
53
54 return 0
55}