Ejemplo n.º 1
0
        public void FixedStringNToStringWorks(String a)
        {
            FixedStringN aa = new FixedStringN(a);

            Assert.AreEqual(a, aa.ToString());
            aa.AssertNullTerminated();
        }
Ejemplo n.º 2
0
        public void FixedStringNEqualsWorks(String a, String b)
        {
            FixedStringN aa = new FixedStringN(a);
            FixedStringN bb = new FixedStringN(b);

            Assert.AreEqual(aa.Equals(bb), a.Equals(b));
            aa.AssertNullTerminated();
            bb.AssertNullTerminated();
        }
Ejemplo n.º 3
0
        public void FixedStringNCopyFromBytesWorks(String a)
        {
            FixedStringN aa = default;

            aa.Junk();
            var utf8 = Encoding.UTF8.GetBytes(a);

            unsafe
            {
                fixed(byte *b = utf8)
                aa.Append(b, (ushort)utf8.Length);
            }
            Assert.AreEqual(a, aa.ToString());
            aa.AssertNullTerminated();

            aa.Append("tail");
            Assert.AreEqual(a + "tail", aa.ToString());
            aa.AssertNullTerminated();
        }
Ejemplo n.º 4
0
        public void FixedStringNFormatExtension1Params()
        {
            FixedStringN aa = default;

            aa.Junk();
            FixedStringN  format = "{0}";
            FixedString32 arg0   = "a";

            aa.AppendFormat(format, arg0);
            Assert.AreEqual("a", aa);
            aa.AssertNullTerminated();
        }
Ejemplo n.º 5
0
        public void FixedStringNFormatExtension3Params()
        {
            FixedStringN aa = default;

            aa.Junk();
            FixedStringN  format = "{0} {1} {2}";
            FixedString32 arg0   = "a";
            FixedString32 arg1   = "b";
            FixedString32 arg2   = "c";

            aa.AppendFormat(format, arg0, arg1, arg2);
            Assert.AreEqual("a b c", aa);
            aa.AssertNullTerminated();
        }
Ejemplo n.º 6
0
        public void FixedStringNFormatExtension6Params()
        {
            FixedStringN aa = default;

            aa.Junk();
            FixedStringN  format = "{0} {1} {2} {3} {4} {5}";
            FixedString32 arg0   = "a";
            FixedString32 arg1   = "b";
            FixedString32 arg2   = "c";
            FixedString32 arg3   = "d";
            FixedString32 arg4   = "e";
            FixedString32 arg5   = "f";

            aa.AppendFormat(format, arg0, arg1, arg2, arg3, arg4, arg5);
            Assert.AreEqual("a b c d e f", aa);
            aa.AssertNullTerminated();
        }
Ejemplo n.º 7
0
        public void FixedStringNFormatExtension9Params()
        {
            FixedStringN aa = default;

            aa.Junk();
            FixedStringN  format = "{0} {1} {2} {3} {4} {5} {6} {7} {8}";
            FixedString32 arg0   = "a";
            FixedString32 arg1   = "b";
            FixedString32 arg2   = "c";
            FixedString32 arg3   = "d";
            FixedString32 arg4   = "e";
            FixedString32 arg5   = "f";
            FixedString32 arg6   = "g";
            FixedString32 arg7   = "h";
            FixedString32 arg8   = "i";

            aa.AppendFormat(format, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
            Assert.AreEqual("a b c d e f g h i", aa);
            aa.AssertNullTerminated();
        }