code wiki / (root) / nx_source_tier_test.nx

nx_source_tier_test.nx source

↩ module page · 64 lines · 2855 B

1// nx_source_tier_test.nx -- KAT for the source-tier classifier. 2// Native sovereign lane; exit 0 = pass, N = assertion N failed. 3 4import "fx.nx" 5import "nx_source_tier.nx" 6 7func main() -> i64 { 8 let v_raw: *u8 = sys_mmap(NX_TIER_VERDICT_BYTES) 9 let v: *NxTierVerdict = v_raw as *NxTierVerdict 10 11 // IMDb = primary, first-hand, score 1.0 12 nx_tier_classify("https://www.imdb.com/name/nm0046215/", "Diora Baird", v) 13 if v.tier != NX_TIER_PRIMARY { return 1 } 14 if v.is_primary != 1 { return 2 } 15 if v.score != FX_ONE { return 3 } 16 17 // YouTube reaction = platform; is_derivative flagged as METADATA but NOT 18 // suppressed (2026-05-29 cardinal: no prejudging) -> gain = platform score. 19 nx_tier_classify("https://www.youtube.com/watch?v=abc", 20 "Diora Baird Tropic Thunder Scene REACTION!!", v) 21 if v.tier != NX_TIER_PLATFORM { return 4 } 22 if v.is_derivative != 1 { return 5 } 23 if v.is_primary != 0 { return 6 } 24 if nx_tier_gain(v) != fx_from_frac(7, 10) { return 7 } 25 26 // ScreenRant listicle = editorial; is_derivative flagged (metadata) but 27 // value NOT zeroed -> gain = editorial score (unique content can rank). 28 nx_tier_classify("https://screenrant.com/diora-baird-movies-ranked/", 29 "10 Best Diora Baird Movies Ranked", v) 30 if v.tier != NX_TIER_EDITORIAL { return 8 } 31 if v.is_derivative != 1 { return 9 } 32 if nx_tier_gain(v) != fx_from_frac(9, 10) { return 10 } 33 34 // Variety news (no signal) = editorial, not derivative, gain 0.9 35 nx_tier_classify("https://variety.com/2008/film/news/diora-baird-cast", 36 "Diora Baird joins Tropic Thunder", v) 37 if v.tier != NX_TIER_EDITORIAL { return 11 } 38 if v.is_derivative != 0 { return 12 } 39 if v.score != fx_from_frac(9, 10) { return 13 } 40 41 // Getty primary photo = primary, first-hand 42 nx_tier_classify("https://www.gettyimages.com/photos/diora-baird", "", v) 43 if v.is_primary != 1 { return 14 } 44 45 // Archive = archive tier, score 0.6 46 nx_tier_classify("https://web.archive.org/web/2009/fansite/diora", "Gallery", v) 47 if v.tier != NX_TIER_ARCHIVE { return 15 } 48 if v.score != fx_from_frac(6, 10) { return 16 } 49 50 // Unknown blog = unknown, score 0.3 51 nx_tier_classify("https://someblog.xyz/diora", "random", v) 52 if v.tier != NX_TIER_UNKNOWN { return 17 } 53 if v.score != fx_from_frac(3, 10) { return 18 } 54 55 // verified 2026-05-29: aggregator catalogs are EDITORIAL, not primary, 56 // so they never earn first-hand gain. 57 nx_tier_classify("https://www.themoviedb.org/person/diora-baird", "Diora Baird", v) 58 if v.tier != NX_TIER_EDITORIAL { return 19 } 59 if v.is_primary != 0 { return 20 } 60 nx_tier_classify("https://www.rottentomatoes.com/celebrity/diora_baird", "", v) 61 if v.tier != NX_TIER_EDITORIAL { return 21 } 62 63 return 0 64}