public void FixedStringNFormatExtension1Params()
        {
            FixedStringN aa = default;

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

            aa.AppendFormat(format, arg0);
            Assert.AreEqual("a", aa);
            aa.AssertNullTerminated();
        }
        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();
        }
Beispiel #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();
        }
        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();
        }
        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();
        }