예제 #1
0
        public void ToString_returns_tag_hieararchy()
        {
            // arrange
            NbtDocument   target;
            string        expected;
            string        actual;
            StringBuilder sb;

            target = new NbtDocument(this.CreateComplexData());

            sb = new StringBuilder();
            sb.AppendLine("compound:Level");
            sb.AppendLine("  long:longTest [9223372036854775807]");
            sb.AppendLine("  short:shortTest [32767]");
            sb.AppendLine("  string:stringTest [HELLO WORLD THIS IS A TEST STRING едж!]");
            sb.AppendLine("  float:floatTest [0.4982315]");
            sb.AppendLine("  int:intTest [2147483647]");
            sb.AppendLine("  compound:nested compound test");
            sb.AppendLine("    compound:ham");
            sb.AppendLine("      string:name [Hampus]");
            sb.AppendLine("      float:value [0.75]");
            sb.AppendLine("    compound:egg");
            sb.AppendLine("      string:name [Eggbert]");
            sb.AppendLine("      float:value [0.5]");
            sb.AppendLine("  list:listTest (long)");
            sb.AppendLine("    long#0 [11]");
            sb.AppendLine("    long#1 [12]");
            sb.AppendLine("    long#2 [13]");
            sb.AppendLine("    long#3 [14]");
            sb.AppendLine("    long#4 [15]");
            sb.AppendLine("  list:listTest (compound)");
            sb.AppendLine("    compound#0");
            sb.AppendLine("      string:name [Compound tag #0]");
            sb.AppendLine("      long:created-on [1264099775885]");
            sb.AppendLine("    compound#1");
            sb.AppendLine("      string:name [Compound tag #1]");
            sb.AppendLine("      long:created-on [1264099775885]");
            sb.AppendLine("  byte:byteTest [127]");
            sb.AppendLine("  bytearray:byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...)) [00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30, 00, 3E, 22, 10, 08, 0A, 16, 2C, 4C, 12, 46, 20, 04, 56, 4E, 50, 5C, 0E, 2E, 58, 28, 02, 4A, 38, 30, 32, 3E, 54, 10, 3A, 0A, 48, 2C, 1A, 12, 14, 20, 36, 56, 1C, 50, 2A, 0E, 60, 58, 5A, 02, 18, 38, 62, 32, 0C, 54, 42, 3A, 3C, 48, 5E, 1A, 44, 14, 52, 36, 24, 1C, 1E, 2A, 40, 60, 26, 5A, 34, 18, 06, 62, 00, 0C, 22, 42, 08, 3C, 16, 5E, 4C, 44, 46, 52, 04, 24, 4E, 1E, 5C, 40, 2E, 26, 28, 34, 4A, 06, 30]");
            sb.AppendLine("  double:doubleTest [0.493128713218231]");

            expected = sb.ToString();

            // act
            actual = target.ToString();

            // assert
            Assert.AreEqual(expected, actual);
        }