private static void test_beers() { var units = new string[] { "", "K", "M", "G", "T", "P", "E", "Z" }; var p = new NUmericPrettyfier(1000.0, units); AssertEquals("10.3 T", p.Prettify("10,328,109,349,120")); AssertEquals("0", p.Prettify("0")); AssertEquals("1", p.Prettify("1")); AssertEquals("1 K", p.Prettify("1000")); AssertEquals("1.02 K", p.Prettify("1024")); AssertEquals("974 K", p.Prettify("973,600")); AssertEquals("1 M", p.Prettify("1,000,000")); AssertEquals("1.05 M", p.Prettify("1,048,576")); }
private static void test_beers() { var units = new string[] { "", "K", "M", "G", "T", "P", "E", "Z" }; var p = new NUmericPrettyfier(1000.0, units); AssertEquals("10.3 T", p.Prettify("10,328,109,349,120")); AssertEquals("0", p.Prettify("0")); AssertEquals("1", p.Prettify("1")); AssertEquals("1 K", p.Prettify("1000")); AssertEquals("1.02 K", p.Prettify("1024")); AssertEquals("974 K", p.Prettify("973,600")); AssertEquals("1 M", p.Prettify("1,000,000")); AssertEquals("1.05 M", p.Prettify("1,048,576")); }
private static void test_file_sizes() { var units = new string[] { "", "KB", "MB", "GB", "TB", "PB", "EB", "ZB" }; var p = new NUmericPrettyfier(1000.0, units); AssertEquals("-1", p.Prettify("-1")); AssertEquals("-1", p.Prettify("-1.001")); AssertEquals("10.3 TB", p.Prettify("10,328,109,349,120")); AssertEquals("0", p.Prettify("0.0")); AssertEquals("0", p.Prettify("0")); AssertEquals("1", p.Prettify("1")); AssertEquals("1", p.Prettify("1.001")); AssertEquals("1 KB", p.Prettify("1000")); AssertEquals("1.02 KB", p.Prettify("1024")); AssertEquals("974 KB", p.Prettify("973,600")); AssertEquals("1 MB", p.Prettify("1,000,000")); AssertEquals("1.05 MB", p.Prettify("1,048,576")); AssertEquals("10.3 TB", p.Prettify("10,328,109,349,120")); AssertEquals("0", p.Prettify("-0.0")); AssertEquals("0", p.Prettify("-0")); AssertEquals("-1", p.Prettify("-1")); AssertEquals("-1", p.Prettify("-1.001")); AssertEquals("-1 KB", p.Prettify("-1000")); AssertEquals("-1.02 KB", p.Prettify("-1024")); AssertEquals("-974 KB", p.Prettify("-973,600")); AssertEquals("-1 MB", p.Prettify("-1,000,000")); AssertEquals("-1.05 MB", p.Prettify("-1,048,576")); }
private static void test_file_sizes() { var units = new string[] {"", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"}; var p = new NUmericPrettyfier(1000.0, units); AssertEquals("-1", p.Prettify("-1")); AssertEquals("-1", p.Prettify("-1.001")); AssertEquals("10.3 TB", p.Prettify("10,328,109,349,120")); AssertEquals("0", p.Prettify("0.0")); AssertEquals("0", p.Prettify("0")); AssertEquals("1", p.Prettify("1")); AssertEquals("1", p.Prettify("1.001")); AssertEquals("1 KB", p.Prettify("1000")); AssertEquals("1.02 KB", p.Prettify("1024")); AssertEquals("974 KB", p.Prettify("973,600")); AssertEquals("1 MB", p.Prettify("1,000,000")); AssertEquals("1.05 MB", p.Prettify("1,048,576")); AssertEquals("10.3 TB", p.Prettify("10,328,109,349,120")); AssertEquals("0", p.Prettify("-0.0")); AssertEquals("0", p.Prettify("-0")); AssertEquals("-1", p.Prettify("-1")); AssertEquals("-1", p.Prettify("-1.001")); AssertEquals("-1 KB", p.Prettify("-1000")); AssertEquals("-1.02 KB", p.Prettify("-1024")); AssertEquals("-974 KB", p.Prettify("-973,600")); AssertEquals("-1 MB", p.Prettify("-1,000,000")); AssertEquals("-1.05 MB", p.Prettify("-1,048,576")); }