private static IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var namespaces = new UnitNamespaces(Resource.NamespaceByte1000); builder.Add(24, namespaces + new UnitDefinition("yottabyte", "YB", "Represents a Yottabyte (symbol YB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Yottabyte = 1,000 Zettabytes\n- 1 Yottabyte = 10^24 Bytes")); builder.Add(21, namespaces + new UnitDefinition("zettabyte", "ZB", "Represents a Zettabyte (symbol ZB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Zettabyte = 1,000 Exabytes\n- 1 Zettabyte = 10^21 Bytes")); builder.Add(18, namespaces + new UnitDefinition("exabyte", "EB", "Represents a Exabyte (symbol EB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Exabyte = 1,000 Petabytes\n- 1 Exabyte = 10^18 Bytes")); builder.Add(15, namespaces + new UnitDefinition("petabyte", "PB", "Represents a Petabyte (symbol PB).\n It is a multiple of the unit <c>Byte</c>, where:\n- 1 Petabyte = 1,000 Terabytes\n- 1 Petabyte = 10^15 Bytes")); builder.Add(12, namespaces + new UnitDefinition("terabyte", "TB", "Represents a Terabyte (symbol TB).\n It is a multiple of the unit <c>Byte</c>, where:\n- 1 Terabyte = 1,000 Gigabytes\n- 1 Terabyte = 10^12 Bytes")); builder.Add(09, namespaces + new UnitDefinition("gigabyte", "GB", "Represents a Gigabyte (symbol GB).\n It is a multiple of the unit <c>Byte</c>, where:\n- 1 Gigabyte = 1,000 Megabytes\n- 1 Gigabyte = 10^9 Bytes")); builder.Add(06, namespaces + new UnitDefinition("megabyte", "MB", "Represents a Megabyte (symbol MB).\n It is a multiple of the unit <c>Byte</c>, where:\n- 1 Megabyte = 1,000 Kilobytes\n- 1 Megabyte = 10^6 Bytes")); builder.Add(03, namespaces + new UnitDefinition("kilobyte", "kB", "Represents a Kilobyte (symbol kB).\n It is a multiple of the unit <c>Byte</c>, where:\n- 1 Kilobyte = 1,000 Bytes\n- 1 Kilobyte = 10^3 Bytes")); builder.Add(00, namespaces + new UnitDefinition("byte", "B", "Represents a Byte (symbol B).\nWhere:\n- 1 Byte = 8 Bits")); builder.TestCases = new[] { // Ym, Zm, Em, Pm, Tm, Gm, Mm, km, m // 10e+24, 10e+21, 10e+18, 10e+15, 10e+12, 10e+9, 10e+6, 10e+3, 10e0 new[] { 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d }, new[] { 13.7e24, 13.7e21, 13.7e18, 13.7e15, 13.7e12, 13.7e9, 13.7e6, 13.7e3, 13.7e0 }, new[] { -5e24, -5e21, -5e18, -5e15, -5e12, -5e9, -5e6, -5e3, -5e0 }, new[] { 1e0, 1e-3, 1e-6, 1e-9, 1e-12, 1e-15, 1e-18, 1e-21, 1e-24 }, }; return(builder.Build()); }
private static IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(2); var namespaces = new UnitNamespaces(Resource.NamespaceByte1024); builder.Add(80, namespaces + new UnitDefinition("yobibyte", "YiB", "Represents a Yobibyte (symbol YiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Yobibyte = 1,024 Zebibytes\n- 1 Yobibyte = 1024^8 or 2^80 Bytes")); builder.Add(70, namespaces + new UnitDefinition("zebibyte", "ZiB", "Represents a Zebibyte (symbol ZiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Zebibyte = 1,024 Exbibytes\n- 1 Zebibyte = 1024^7 or 2^70 Bytes")); builder.Add(60, namespaces + new UnitDefinition("exbibyte", "EiB", "Represents a Exbibyte (symbol EiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Exbibyte = 1,024 Pebibytes\n- 1 Exbibyte = 1024^6 or 2^60 Bytes")); builder.Add(50, namespaces + new UnitDefinition("pebibyte", "PiB", "Represents a Pebibyte (symbol PiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Pebibyte = 1,024 Tebibytes\n- 1 Pebibyte = 1024^5 or 2^50 Bytes")); builder.Add(40, namespaces + new UnitDefinition("tebibyte", "TiB", "Represents a Tebibyte (symbol TiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Tebibyte = 1,024 Gibibytes\n- 1 Tebibyte = 1024^4 or 2^40 Bytes")); builder.Add(30, namespaces + new UnitDefinition("gibibyte", "GiB", "Represents a Gibibyte (symbol GiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Gibibyte = 1,024 Mebibytes\n- 1 Gibibyte = 1024^3 or 2^30 Bytes")); builder.Add(20, namespaces + new UnitDefinition("mebibyte", "MiB", "Represents a Mebibyte (symbol MiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Mebibyte = 1,024 Kibibytes\n- 1 Mebibyte = 1024^2 or 2^20 Bytes")); builder.Add(10, namespaces + new UnitDefinition("kibibyte", "KiB", "Represents a Kibibyte (symbol KiB).\nIt is a multiple of the unit <c>Byte</c>, where:\n- 1 Kibibyte = 1,024 bytes \n- 1 Kibibyte = 1024^1 or 2^10 Bytes")); builder.Add(00, namespaces + new UnitDefinition("byte", "B", "Represents a Byte (symbol B).\nWhere:\n- 1 Byte = 8 Bits")); builder.TestCases = new[] { // yottabyte, zettabyte, exabyte, petabyte, terabyte, gigabyte, megabyte, kilobyte, byte // 2e+80, 2e+70, 2e+60, 2e+50, 2e+40, 2e+30, 2e+20, 2e+10, 2e+0 new[] { 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d }, new[] { Math.Pow(2, 80), Math.Pow(2, 70), Math.Pow(2, 60), Math.Pow(2, 50), Math.Pow(2, 40), Math.Pow(2, 30), Math.Pow(2, 20), Math.Pow(2, 10), Math.Pow(2, 00) }, new[] { -5 * Math.Pow(2, 80), -5 * Math.Pow(2, 70), -5 * Math.Pow(2, 60), -5 * Math.Pow(2, 50), -5 * Math.Pow(2, 40), -5 * Math.Pow(2, 30), -5 * Math.Pow(2, 20), -5 * Math.Pow(2, 10), -5 * Math.Pow(2, 00) }, new[] { 3 * Math.Pow(2, 00), 3 * Math.Pow(2, -10), 3 * Math.Pow(2, -20), 3 * Math.Pow(2, -30), 3 * Math.Pow(2, -40), 3 * Math.Pow(2, -50), 3 * Math.Pow(2, -60), 3 * Math.Pow(2, -70), 3 * Math.Pow(2, -80) }, new[] { 13.7 * Math.Pow(2, 80), 13.7 * Math.Pow(2, 70), 13.7 * Math.Pow(2, 60), 13.7 * Math.Pow(2, 50), 13.7 * Math.Pow(2, 40), 13.7 * Math.Pow(2, 30), 13.7 * Math.Pow(2, 20), 13.7 * Math.Pow(2, 10), 13.7 * Math.Pow(2, 00) }, }; return(builder.Build()); }
protected IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var baseUnit = GetBaseUnit(); var baseSymbol = GetBaseSymbol(); var namespaces = new UnitNamespaces(GetNamespace()); builder.Add(+3, namespaces + new UnitDefinition($"kilo{baseUnit}", $"k{baseSymbol}")); builder.Add(+2, namespaces + new UnitDefinition($"hecto{baseUnit}", $"h{baseSymbol}")); builder.Add(+1, namespaces + new UnitDefinition($"deca{baseUnit}", $"da{baseSymbol}")); builder.Add(00, namespaces + new UnitDefinition($"{baseUnit}", $"{baseSymbol}")); builder.Add(-1, namespaces + new UnitDefinition($"deci{baseUnit}", $"d{baseSymbol}")); builder.Add(-2, namespaces + new UnitDefinition($"centi{baseUnit}", $"c{baseSymbol}")); builder.Add(-3, namespaces + new UnitDefinition($"milli{baseUnit}", $"m{baseSymbol}")); builder.TestCases = new[] { // kX, hX, daX, X, dX, cX, mX // 10e+3, 10e+2, 10e+1, 10e0, 10e-1, 10e-2, 10e-3 new[] { 0d, 0d, 0d, 0d, 0d, 0d, 0d }, new[] { 13.7e3, 13.7e2, 13.7e1, 13.7e0, 13.7e-1, 13.7e-2, 13.7e-3 }, new[] { -5e3, -5e2, -5e1, -5e0, -5e-1, -5e-2, -5e-3 }, new[] { 1e0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6 }, new[] { 2e6, 2e5, 2e4, 2e3, 2e2, 2e1, 2e0 }, }; return(builder.Build()); }
public IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var namespaces = new UnitNamespaces(Resource.NamespaceCubicMetre); builder.Add(+9, namespaces + new UnitDefinition("cubic kilometre", "km³", "Represents a Cubic Kilometre (symbol km³).\nIt is a multiple of the unit <c>Cubic Metre</c>, where:\n- 1 Cubic Kilometre = 1,000 Cubic Hectometre\n- 1 Cubic Kilometre = 10^9 Cubic Metre")); builder.Add(+6, namespaces + new UnitDefinition("cubic hectometre", "hm³", "Represents a Cubic Hectometre (symbol hm³).\nIt is a multiple of the unit <c>Cubic Metre</c>, where:\n- 1 Cubic Hectometre = 1,000 Cubic Decametre\n- 1 Cubic Hectometre = 10^6 Cubic Metre")); builder.Add(+3, namespaces + new UnitDefinition("cubic decametre", "dam³", "Represents a Cubic Decametre (symbol dam³).\nIt is a multiple of the unit <c>Cubic Metre</c>, where:\n- 1 Cubic Decametre = 1,000 Cubic Metre\n- 1 Cubic Decametre = 10^3 Cubic Metre")); builder.Add(00, namespaces + new UnitDefinition("cubic metre", "m³")); builder.Add(-3, namespaces + new UnitDefinition("cubic decimetre", "dm³", "Represents a Cubic Decimetre (symbol dm³).\nIt is a multiple of the unit <c>Cubic Metre</c>, where:\n- 1,000 Cubic Decimetre = 1 Cubic Metre\n- 1 Cubic Decimetre = 10^-3 Cubic Metre")); builder.Add(-6, namespaces + new UnitDefinition("cubic centimetre", "cm³", "Represents a Cubic Centimetre (symbol cm³).\nIt is a multiple of the unit <c>Cubic Metre</c>, where:\n- 1,000 Cubic Centimetre = 1 Cubic Decimetre\n- 1 Cubic Centimetre = 10^-6 Cubic Metre")); builder.Add(-9, namespaces + new UnitDefinition("cubic millimetre", "mm³", "Represents a Cubic Millimetre (symbol mm³).\nIt is a multiple of the unit <c>Cubic Metre</c>, where:\n- 1,000 Cubic Millimetre = 1 Cubic Centimetre\n- 1 Cubic Millimetre = 10^-9 Cubic Metre")); builder.TestCases = new[] { // km, hm, dam, m, dm, cm, mm // 10e+9, 10e+6, 10e+3, 10e0, 10e-3, 10e-6, 10e-9 new[] { 0d, 0d, 0d, 0d, 0d, 0d, 0d }, new[] { -5e9, -5e6, -5e3, -5e0, -5e-3, -5e-6, -5e-9 }, new[] { 13.7e9, 13.7e6, 13.7e3, 13.7e0, 13.7e-3, 13.7e-6, 13.7e-9 }, new[] { 1e0, 1e-3, 1e-6, 1e-9, 1e-12, 1e-15, 1e-18 }, new[] { 1e18, 1e15, 1e12, 1e9, 1e6, 1e3, 1e0 } }; return(builder.Build()); }
private static IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var namespaces = new UnitNamespaces(Resource.NamespacePixel); builder.Add(06, namespaces + new UnitDefinition("megapixel", "MP", "Represents a Megapixel (symbol MP).\nIt is a multiple of the unit <c>Pixel</c>, where:\n- 1 Megapixel = 1,000,000 Pixels")); builder.Add(00, namespaces + new UnitDefinition("pixel", "px")); builder.TestCases = new[] { // megapixel, pixel // 10e+6, 10e0 new[] { 0d, 0d }, new[] { 13.7e6, 13.7e0 }, new[] { -5e0, -5e-6 }, new[] { 1e-6, 1e-12 } }; return(builder.Build()); }
private static IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var namespaces = new UnitNamespaces(Resource.NamespaceBit); builder.Add(12, namespaces + new UnitDefinition("terabit", "Tb", "Represents a Terabit (symbol Tb).\nIt is a multiple of the unit <c>Bit</c>, where:\n- 1 Terabit = 1,000 Gigabit\n- 1 Terabit = 10^12 Bits")); builder.Add(09, namespaces + new UnitDefinition("gigabit", "Gb", "Represents a Gigabit (symbol Gb).\nIt is a multiple of the unit <c>Bit</c>, where:\n- 1 Gigabit = 1,000 Megabit\n- 1 Gigabit = 10^9 Bits")); builder.Add(06, namespaces + new UnitDefinition("megabit", "Mb", "Represents a Megabit (symbol Mb).\nIt is a multiple of the unit <c>Bit</c>, where:\n- 1 Megabit = 1,000 Kilobit\n- 1 Megabit = 10^6 Bits")); builder.Add(03, namespaces + new UnitDefinition("kilobit", "Kb", "Represents a Kilobit (symbol Kb).\nIt is a multiple of the unit <c>Bit</c>, where:\n- 1 Kilobit = 1,000 Bits\n- 1 Kilobit = 10^3 Bits")); builder.Add(00, namespaces + new UnitDefinition("bit", "b", "Represents a Bit (symbol b).\nWhere:\n- 8 bits = 1 byte")); builder.TestCases = new[] { // terabit, gigabit, megabit, kilobit, bit // 10e+12, 10e+9, 10e+6, 10e+3, 10e0 new[] { 0d, 0d, 0d, 0d, 0d }, new[] { 13.7e12, 13.7e9, 13.7e6, 13.7e3, 13.7e0 }, new[] { -5e6, -5e3, -5e0, -5e-3, -5e-6 }, new[] { 1e0, 1e-3, 1e-6, 1e-9, 1e-12 } }; return(builder.Build()); }
public IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var namespaces = new UnitNamespaces(Resource.NamespaceSquareMetre); builder.Add(+36, namespaces + new UnitDefinition("square exametre", "Em²")); builder.Add(+30, namespaces + new UnitDefinition("square petametre", "Pm²")); builder.Add(+24, namespaces + new UnitDefinition("square terametre", "Tm²")); builder.Add(+18, namespaces + new UnitDefinition("square gigametre", "Gm²")); builder.Add(+12, namespaces + new UnitDefinition("square megametre", "Mm²")); builder.Add(+06, namespaces + new UnitDefinition("square kilometre", "km²")); builder.Add(+04, namespaces + new UnitDefinition("square hectometre", "hm²")); builder.Add(+02, namespaces + new UnitDefinition("square decametre", "dam²")); builder.Add(000, namespaces + new UnitDefinition("square metre", "m²")); builder.Add(-02, namespaces + new UnitDefinition("square decimetre", "dm²")); builder.Add(-04, namespaces + new UnitDefinition("square centimetre", "cm²")); builder.Add(-06, namespaces + new UnitDefinition("square millimetre", "mm²")); builder.Add(-12, namespaces + new UnitDefinition("square micrometre", "μm²")); builder.Add(-18, namespaces + new UnitDefinition("square nanometre", "nm²")); builder.Add(-24, namespaces + new UnitDefinition("square picometre", "pm²")); builder.Add(-30, namespaces + new UnitDefinition("square femtometre", "fm²")); builder.Add(-36, namespaces + new UnitDefinition("square attometre", "am²")); builder.TestCases = new[] { // Em, Pm, Tm, Gm, Mm, km, hm, dam, m, dm, cm, mm, um, nm, pm, fm, am // 10e+36, 10e+30, 10e+24, 10e+18, 10e+12, 10e+6, 10e+4, 10e+2, 10e0, 10e-2, 10e-4, 10e-6, 10e-12, 10e-18, 10e-24, 10e-30, 10e-36 new[] { 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d }, new[] { -5e36, -5e30, -5e24, -5e18, -5e12, -5e6, -5e4, -5e2, -5e0, -5e-2, -5e-4, -5e-6, -5e-12, -5e-18, -5e-24, -5e-30, -5e-36 }, new[] { 13.7e36, 13.7e30, 13.7e24, 13.7e18, 13.7e12, 13.7e6, 13.7e4, 13.7e2, 13.7e0, 13.7e-2, 13.7e-4, 13.7e-6, 13.7e-12, 13.7e-18, 13.7e-24, 13.7e-30, 13.7e-36 }, new[] { 1e0, 1e-6, 1e-12, 1e-18, 1e-24, 1e-30, 1e-32, 1e-34, 1e-36, 1e-38, 1e-40, 1e-42, 1e-48, 1e-54, 1e-60, 1e-66, 1e-72 }, new[] { 1e72, 1e66, 1e60, 1e54, 1e48, 1e42, 1e40, 1e38, 1e36, 1e34, 1e32, 1e30, 1e24, 1e18, 1e12, 1e6, 1e0 } }; return(builder.Build()); }
private static IReadOnlyCollection <ContextWithCastByPower> BuildContexts() { var builder = new ContextWithCastByPowerBuilder(10); var namespaces = new UnitNamespaces(Resource.NamespaceMetre); builder.Add(+18, namespaces + new UnitDefinition("exametre", "Em")); builder.Add(+15, namespaces + new UnitDefinition("petametre", "Pm")); builder.Add(+12, namespaces + new UnitDefinition("terametre", "Tm")); builder.Add(+09, namespaces + new UnitDefinition("gigametre", "Gm")); builder.Add(+06, namespaces + new UnitDefinition("megametre", "Mm")); builder.Add(+03, namespaces + new UnitDefinition("kilometre", "km")); builder.Add(+02, namespaces + new UnitDefinition("hectometre", "hm")); builder.Add(+01, namespaces + new UnitDefinition("decametre", "dam")); builder.Add(000, namespaces + new UnitDefinition("metre", "m")); builder.Add(-01, namespaces + new UnitDefinition("decimetre", "dm")); builder.Add(-02, namespaces + new UnitDefinition("centimetre", "cm")); builder.Add(-03, namespaces + new UnitDefinition("millimetre", "mm")); builder.Add(-06, namespaces + new UnitDefinition("micrometre", "μm")); builder.Add(-09, namespaces + new UnitDefinition("nanometre", "nm")); builder.Add(-12, namespaces + new UnitDefinition("picometre", "pm")); builder.Add(-15, namespaces + new UnitDefinition("femtometre", "fm")); builder.Add(-18, namespaces + new UnitDefinition("attometre", "am")); builder.TestCases = new[] { // Em, Pm, Tm, Gm, Mm, km, hm, dam, m, dm, cm, mm, um, nm, pm, fm, am // 10e+18, 10e+15, 10e+12, 10e+9, 10e+6, 10e+3, 10e+2, 10e+1, 10e0, 10e-1, 10e-2, 10e-3, 10e-6, 10e-9, 10e-12, 10e-15, 10e-18 new[] { 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d }, new[] { 13.7e18, 13.7e15, 13.7e12, 13.7e9, 13.7e6, 13.7e3, 13.7e2, 13.7e1, 13.7e0, 13.7e-1, 13.7e-2, 13.7e-3, 13.7e-6, 13.7e-9, 13.7e-12, 13.7e-15, 13.7e-18 }, new[] { -5e18, -5e15, -5e12, -5e9, -5e6, -5e3, -5e2, -5e1, -5e0, -5e-1, -5e-2, -5e-3, -5e-6, -5e-9, -5e-12, -5e-15, -5e-18 }, new[] { 1e0, 1e-3, 1e-6, 1e-9, 1e-12, 1e-15, 1e-16, 1e-17, 1e-18, 1e-19, 1e-20, 1e-21, 1e-24, 1e-27, 1e-30, 1e-33, 1e-36 }, new[] { 1e36, 1e33, 1e30, 1e27, 1e24, 1e21, 1e20, 1e19, 1e18, 1e17, 1e16, 1e15, 1e12, 1e9, 1e6, 1e3, 1e0 } }; return(builder.Build()); }