CLDR conformance benchmark and differential tester for MoonBit i18n implementations
Dependencies
状态:M1 适配器契约、能力登记与 --impls 选择已完成。CLDR 官方数据可按不可变 tag 拉取、离线校验并幂等重跑,且已解析成 4714 条用例(数字 2625 / 日期 1752 / MF2 337)。 当前 CLI 可选择并列出适配器;用例执行、失败归因与报告按 开发方案.md §4.2 继续推进。
cmd/fetch-data/ # 数据资产工具:--sync / --verify / 单文件下载(D2 已完成)
cmd/conform/ # 主 CLI:登记适配器、解析 --impls 并清点用例;执行与报告后续接入
cmd/report-site/ # 报告 JSON → 静态 HTML(D16+)
internal/source/ # 目录、下载、摘要、清单、离线校验、幂等同步(D2 已完成)
internal/corpus/ # TSV / JSON 测试数据解析(D3–D4)
internal/engine/ # 用例执行、归因、最小化(D5–D7)
internal/adapter/ # 适配器 trait 对象登记、能力校验与选择(M1)
adapters/ # 每个被测实现一个包,reference_null 用于引擎自测
fixtures/ # 官方测试数据快照 + SOURCES.json(来源与 SHA256)moon check --target all
moon test
# 数据管线(默认已入库,可直接离线校验)
moon run cmd/fetch-data -- --verify
# 需要重新拉取时(幂等:已是最新的文件会跳过)
moon run cmd/fetch-data -- --sync///|
test {
let suites = @cldr-conformance.Suite::all()
assert_eq(suites.length(), 3)
assert_eq(suites[0].label(), "decimal")
}pub(open) trait DatetimeAdapter {
fn name(Self) -> String
fn format_skeleton(Self, locale : String, calendar : String, skeleton : String) -> String raise
fn format_datetime(Self, input : DatetimeFormatInput) -> String raise
}pub(open) trait MessageFormat2Adapter {
fn name(Self) -> String
fn format_message(Self, input : MessageFormat2Input) -> MessageFormat2Result raise
}pub(open) trait NumberAdapter {
fn name(Self) -> String
fn format_number(Self, locale : String, value : String, style~ : NumberStyle, length~ : NumberLength) -> String raise
}fn AdapterCapabilities::contains(self : AdapterCapabilities, capability : AdapterCapability) -> Boolpub(all) struct AdapterReport {
adapter_id : String
summary : RunSummary
by_suite : Array[SuiteSummary]
by_reason : Array[ReasonCount]
failures : Array[FailureDetail]
errors : Array[ErrorDetail]
} derive(Eq, Debug)fn AdapterReport::from_results(adapter_id : String, results : Array[CaseResult], limit? : Int) -> AdapterReportpub(all) enum CaseOutcome {
Pass
Fail(reason~ : FailReason, expected~ : String, actual~ : String)
Errored(detail~ : String)
Unsupported(feature~ : String)
NotInstalled
} derive(Eq, Debug)pub(all) struct CaseResult {
suite : Suite
adapter_id : String
source : String
location : String
outcome : CaseOutcome
elapsed_ms : Int
} derive(Eq, Debug)pub(all) struct DatetimeCase {
locale : String
calendar : String
input : String
expected : String
semantic_skeleton : String?
classical_skeleton : String?
semantic_skeleton_length : String?
zone_style : String?
time_length : String?
date_length : String?
hour_cycle : String?
year_style : String?
date_time_format_type : String?
index : Int
} derive(Eq, Debug)pub(all) struct DatetimeCorpus {
skeletons : Array[SkeletonCase]
formatted : Array[DatetimeCase]
} derive(Eq, Debug)fn DatetimeCorpus::new(skeletons : Array[SkeletonCase], formatted : Array[DatetimeCase]) -> DatetimeCorpuspub(all) struct DatetimeFormatInput {
locale : String
calendar : String
input : String
semantic_skeleton : String?
classical_skeleton : String?
semantic_skeleton_length : String?
zone_style : String?
time_length : String?
date_length : String?
hour_cycle : String?
year_style : String?
date_time_format_type : String?
} derive(Eq, Debug)pub(all) struct DecimalCase {
locale : String
style : NumberStyle
length : NumberLength
input : String
expected : String
line : Int
} derive(Eq, Debug)pub(all) struct FailureDetail {
suite : Suite
source : String
location : String
reason : FailReason
expected : String
actual : String
diff : CharDiff
} derive(Eq, Debug)pub(all) struct Report {
baseline : String
adapters : Array[AdapterReport]
summary : RunSummary
} derive(Eq, Debug)fn Report::from_results(baseline : String, adapter_ids : Array[String], results : Array[CaseResult], limit? : Int) -> Reportfn failure_sample_limit() -> IntInstall
Download zipCLDR conformance benchmark and differential tester for MoonBit i18n implementations
Dependencies