public void FixedTests() { Assert.AreEqual(Base91.Encode("test"), "fPNKd"); Assert.AreEqual(Base91.Encode("Hello World!"), ">OwJh>Io0Tv!8PE"); Assert.AreEqual(Base91.Decode("fPNKd"), "test"); Assert.AreEqual(Base91.Decode(">OwJh>Io0Tv!8PE"), "Hello World!"); }
public static void Main() { Console.WriteLine("[{0}]", Base91.Encode("test")); Console.WriteLine("[{0}]", Base91.Encode("Hello World!")); Console.WriteLine("[{0}]", Base91.Decode("fPNKd")); Console.WriteLine("[{0}]", Base91.Decode(">OwJh>Io0Tv!8PE")); }
public void RandomTests() { var random = new Random(DateTime.Now.Millisecond); for (var i = 0; i < 200; i++) { var origin = string.Format("%s%s%s%s%s%s%s%s%s%s%s", (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString(), (random.NextDouble() * 10000).ToString()); var encodNd = Solution.Encode(origin); Assert.AreEqual(Base91.Encode(origin), encodNd); Assert.AreEqual(Base91.Decode(encodNd), origin); } }
public static string ToBase91(byte[] data) { var base91 = new Base91(); return(base91.Encode(data)); }
public void EncodeTests(string input, string expected) { Assert.AreEqual(Base91.Encode(input), expected); }
public override void OnMemoryData(byte[] obj) { var str = Base91.Encode(obj); mWriter.WriteValue(str); }