Files
Benjamin Admin d9278f256e feat(iace): norm cross-ref batches 6-7 complete — full 671/671 coverage
- Batch 6 (100): EN 1870 saws, EN 81 lift sub-parts, hearing/glove PPE,
  EN 50126 railway, EN 60974 welding, EN 60335-2-x cleaning appliances
- Batch 7 (71): IEC 60601 medical family, EN ISO 19085 woodworking, safety
  footwear (ASTM F2413), fitness (ASTM F2276), chainsaws (OPEI B175.1),
  ISO 4254 agri remainder, acoustics ISO 3743/3745/3747

671 of 671 norms now have at least DIN mapping; ~80% have a US (ANSI/NFPA/
UL/OSHA/ASME/ASTM/SAE/NIOSH) mapping; ~40% have CN-GB and/or JP-JIS.

Added TestCrossRef_SpotChecks with 15 manually vetted region mappings
(IEC 60601 → ANSI/AAMI ES60601, EN 13445 → ASME BPVC, EN 60204 → NFPA 79,
ISO 10218 → RIA R15.06, etc.).

Next steps for follow-up work:
- Add OpenAPI snapshot for new /norms-library/crossref endpoints
- Front-end: render crossref panel on /sdk/iace norm detail page
- Tech file: auto-emit "this requirement also satisfies X in market Y" hints

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 09:32:38 +02:00

61 lines
2.0 KiB
Go

package iace
import (
"testing"
)
// Spot-check sample of cross-references, asserting a couple of well-known
// regional pendants that I personally vetted. If these break, the matrix
// got corrupted; investigate before just updating the test.
func TestCrossRef_SpotChecks(t *testing.T) {
cases := []struct {
normID string
region string
mustHave string
desc string
}{
{"IEC-60601-1", "US-ANSI", "ES60601", "medical electrical equipment → ANSI/AAMI ES60601"},
{"ISO-10218-1", "US-ANSI", "RIA R15.06", "industrial robots → RIA R15.06"},
{"EN-388", "US-ANSI", "ISEA 105", "mech. gloves → ANSI/ISEA 105"},
{"EN-352-1", "US-ANSI", "S3.19", "hearing protection → ANSI S3.19/S12.6"},
{"EN-1176-1", "US-ASTM", "F1487", "playgrounds → ASTM F1487"},
{"EN-13814", "US-ASTM", "F2291", "amusement rides → ASTM F2291"},
{"EN-13445-1", "US-ASME", "Section VIII", "pressure vessels → ASME BPVC VIII"},
{"EN-13480-1", "US-ASME", "B31.3", "process piping → ASME B31.3"},
{"EN-60204-1", "US-NFPA", "NFPA 79", "industrial electrical → NFPA 79"},
{"EN-12453", "US-UL", "UL 325", "garage doors → UL 325"},
{"ISO-11681-1", "US-ANSI", "B175.1", "chainsaws → OPEI B175.1"},
{"EN-ISO-5395-1", "US-ANSI", "B71.1", "lawnmowers → OPEI B71.1"},
{"EN-ISO-20345", "US-ASTM", "F2413", "safety shoes → ASTM F2413"},
{"EN-IEC-61400-1", "INTL-ISO", "IEC 61400-1", "wind turbine design → IEC 61400-1"},
{"EN-149", "US-NIOSH", "42 CFR", "respirators → NIOSH N95 framework"},
}
for _, tc := range cases {
cr := GetNormCrossRef(tc.normID)
found := false
for _, m := range cr.Mappings {
if m.Region == tc.region && contains(m.Identifier, tc.mustHave) {
found = true
break
}
}
if !found {
t.Errorf("[%s] %s: expected %s mapping containing %q", tc.desc, tc.normID, tc.region, tc.mustHave)
}
}
}
func contains(s, sub string) bool {
if sub == "" {
return true
}
for i := 0; i+len(sub) <= len(s); i++ {
if s[i:i+len(sub)] == sub {
return true
}
}
return false
}