// The author keys against the whole of test/vectors/authorkey.json, on the // VM: the signatures and the rune cases that authorkey.g.dart leaves out, // among them the messages of 64 KiB and 1 MiB; and authorkey.g.dart // checked against the file, of which it is a part. @TestOn('vm') library; import 'dart:convert'; import 'dart:io'; import 'package:test/test.dart'; import 'authorkey_support.dart'; import 'vectors/authorkey.g.dart'; void main() { final file = jsonDecode( File('test/vectors/authorkey.json').readAsStringSync(), ) as Json; final part = jsonDecode(authorKeyJson) as Json; test('authorkey.g.dart is a part of authorkey.json', () { for (final k in file.keys) { if (k == 'sign' || k == 'runes') continue; expect(part[k], file[k], reason: k); } expect(part.keys.toSet(), file.keys.toSet()); expect(part['sign'], [ for (final c in listOf(file['sign'])) if (c['node'] == true) c, ]); final runes = file['runes']! as Json; final some = part['runes']! as Json; expect(some['public'], runes['public']); expect(some['secret'], runes['secret']); final all = {for (final c in runes['cases']! as List) jsonEncode(c)}; final cases = some['cases']! as List; expect(cases, isNotEmpty); for (final c in cases) { expect(all, contains(jsonEncode(c))); } }); signTests([ for (final c in listOf(file['sign'])) if (c['node'] != true) c, ]); runeTests(file); }