예제 #1
0
 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!");
 }
예제 #2
0
 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"));
 }
예제 #3
0
    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);
        }
    }
예제 #4
0
        public static string ToBase91(byte[] data)
        {
            var base91 = new Base91();

            return(base91.Encode(data));
        }
예제 #5
0
 public void EncodeTests(string input, string expected)
 {
     Assert.AreEqual(Base91.Encode(input), expected);
 }
예제 #6
0
        public override void OnMemoryData(byte[] obj)
        {
            var str = Base91.Encode(obj);

            mWriter.WriteValue(str);
        }