You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dateKeys-dart/test/formats_differential_test.dart

27 lines
907 B

Stage 4b: the differential of the formats against Go tool/formats_go_vectors.go runs in the module of datekeys-go at c531e93, without changing anything there, and writes test/vectors/formats_*.json: the result, the normative code and the text of Go on inputs of a fixed seed, valid and broken in every layer of spec §69.1, and on the fixtures of testdata/, edited: - the PRELUDE (229 cases), the steps 1 to 3 of capsule.Inspect on cut and edited fixtures (492) and whole .dkk files (268); - PUBLIC_HEADER (660) and CONTROL_CBOR of the three formats (618); - Provider Profiles decoded (163) and validated as values (60); - extension arrays (260), Canonical (80), CheckDisjoint (50), the registries with places (120) and CheckWrite with Standard (60); - dk1_ strings (466); - RFC 3339 parsed (434) and formatted (80), Resolve (320), RoundTime (64), Validate (128) and MaxRound (8), on profiles of other genesis times and periods; - PaddedLength and PayloadAgeLength at the boundaries up to L_MAX (474), and the check of the padding of capsule.Open at step 17 on fixtures whose PAYLOAD_AGE is encrypted again with an edited plaintext (56); - the encoders on values and the decoders at the limits of spec §57 (90); - the frame of BODY (260) and the zeros of the area (60). The output is the same on every run. formats_vectors.g.dart holds every eighth case as Dart constants, so that the differential runs compiled to JavaScript too, on Node.js; a test on the VM checks that they are those of the files. Every file is under 310 KB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 days ago
// The differential of the formats against the Go reference on the part of
// the cases that test/vectors/formats_vectors.g.dart holds: it reads no
// file, so it also runs compiled to JavaScript, where the integers of the
// frames, of the rounds and of the padding must be exact too.
library;
import 'dart:convert';
import 'formats_differential.dart';
import 'vectors/formats_vectors.g.dart';
void main() {
Json parse(String text) => jsonDecode(text) as Json;
formatsDifferential({
'framing': parse(formatsFramingJson),
'header': parse(formatsHeaderJson),
'control': parse(formatsControlJson),
'profile': parse(formatsProfileJson),
'extension': parse(formatsExtensionJson),
'datekey': parse(formatsDatekeyJson),
'time': parse(formatsTimeJson),
'padding': parse(formatsPaddingJson),
'body': parse(formatsBodyJson),
'encode': parse(formatsEncodeJson),
});
}

Powered by TurnKey Linux.