public void testHanzi()
        {
            BitSourceBuilder builder = new BitSourceBuilder();

            builder.write(0x0D, 4); // Hanzi mode
            builder.write(0x01, 4); // Subset 1 = GB2312 encoding
            builder.write(0x01, 8); // 1 characters
            builder.write(0x03C1, 13);
            String result = DecodedBitStreamParser.decode(builder.toByteArray(),
                                                          Version.getVersionForNumber(1), null, null).Text;

            Assert.AreEqual("\u963f", result);
        }
        public void testHanziLevel1()
        {
            BitSourceBuilder builder = new BitSourceBuilder();

            builder.write(0x0D, 4); // Hanzi mode
            builder.write(0x01, 4); // Subset 1 = GB2312 encoding
            builder.write(0x01, 8); // 1 characters
            // A5A2 (U+30A2) => A5A2 - A1A1 = 401, 4*60 + 01 = 0181
            builder.write(0x0181, 13);
            String result = DecodedBitStreamParser.decode(builder.toByteArray(),
                                                          Version.getVersionForNumber(1), null, null).Text;

            Assert.That(result, Is.EqualTo("\u30a2"));
        }
        public void testSimpleByteMode()
        {
            BitSourceBuilder builder = new BitSourceBuilder();

            builder.write(0x04, 4); // Byte mode
            builder.write(0x03, 8); // 3 bytes
            builder.write(0xF1, 8);
            builder.write(0xF2, 8);
            builder.write(0xF3, 8);
            String result = DecodedBitStreamParser.decode(builder.toByteArray(),
                                                          Version.getVersionForNumber(1), null, null).Text;

            Assert.AreEqual("\u00f1\u00f2\u00f3", result);
        }
        public void testSimpleSJIS()
        {
            BitSourceBuilder builder = new BitSourceBuilder();

            builder.write(0x04, 4); // Byte mode
            builder.write(0x04, 8); // 4 bytes
            builder.write(0xA1, 8);
            builder.write(0xA2, 8);
            builder.write(0xA3, 8);
            builder.write(0xD0, 8);
            String result = DecodedBitStreamParser.decode(builder.toByteArray(),
                                                          Version.getVersionForNumber(1), null, null).Text;

            Assert.AreEqual("\uff61\uff62\uff63\uff90", result);
        }
        public void testECI()
        {
            BitSourceBuilder builder = new BitSourceBuilder();

            builder.write(0x07, 4); // ECI mode
            builder.write(0x02, 8); // ECI 2 = CP437 encoding
            builder.write(0x04, 4); // Byte mode
            builder.write(0x03, 8); // 3 bytes
            builder.write(0xA1, 8);
            builder.write(0xA2, 8);
            builder.write(0xA3, 8);
            String result = DecodedBitStreamParser.decode(builder.toByteArray(),
                                                          Version.getVersionForNumber(1), null, null).Text;

            Assert.AreEqual("\u00ed\u00f3\u00fa", result);
        }