Example #1
0
        public void TestSingleLine()
        {
            var writer  = new StringWriter();
            var builder = new CTFBuilder(writer);

            builder.AddDenseSample("a", new float[] { 1, 2, 3 });
            builder.AddDenseSample("b", new float[] { 3.14f });

            builder.Finish();

            var s = writer.ToString();

            Assert.AreEqual("0\t|a 1 2 3\t|b 3.14", s);
        }
Example #2
0
        public void TestSequence()
        {
            var writer  = new StringWriter();
            var builder = new CTFBuilder(writer, 0, false);

            builder.AddDenseSample("a", new float[] { 1, 2, 3 });
            builder.NextLine();
            builder.AddDenseSample("b", new float[] { 3.14f });
            builder.NextLine();
            builder.NextSequence();
            builder.AddDenseSample("c", new float[] { 5 });
            builder.AddDenseSample("d", new float[] { 10 });
            builder.NextLine();

            builder.Finish();

            var s = writer.ToString();

            Assert.AreEqual("0\t|a 1 2 3\r\n0\t|b 3.14\r\n1\t|c 5\t|d 10", s);
        }
Example #3
0
        public void TestComment()
        {
            var writer  = new StringWriter();
            var builder = new CTFBuilder(writer, 0, false);

            builder.AddComment("hello world");
            builder.AddDenseSample("a", new float[] { 1, 2 });

            builder.Finish();

            var s = writer.ToString();

            Assert.AreEqual("0\t|# hello world\t|a 1 2", s);
        }