Created
February 6, 2021 05:37
-
-
Save kentcb/0ab3feb4e3491f9a4a904da88147a03b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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