Skip to content

Instantly share code, notes, and snippets.

@kentcb
Created February 6, 2021 05:37
Show Gist options
  • Save kentcb/0ab3feb4e3491f9a4a904da88147a03b to your computer and use it in GitHub Desktop.
Save kentcb/0ab3feb4e3491f9a4a904da88147a03b to your computer and use it in GitHub Desktop.
final units = InformationUnit.values;
for (var i = 1; i < units.length; ++i) {
final unit = units[i];
final bits = unit.numberOfBitsComprisingUnit;
print("test('${unit.name}s calculates correctly', () {");
print(" final sut = InformationSize.fromBits(BigInt.parse('${bits + (bits >> 1)}'));");
print(" final result = sut.${unit.name}s;");
print(" expect(result, 1.5);");
print("});");
print("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment