/*
 * Copyright 2008 ZXing authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.zxing.qrcode.decoder;

import com.google.zxing.ReaderException;
import com.google.zxing.common.BitSourceBuilder;
import junit.framework.TestCase;

/**
 * Tests {@link com.google.zxing.qrcode.decoder.DecodedBitStreamParser}.
 *
 * @author srowen@google.com (Sean Owen)
 */
public final class DecodedBitStreamParserTestCase extends TestCase {

  public void testSimpleByteMode() throws ReaderException {
    BitSourceBuilder builder = new BitSourceBuilder();
    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));
    assertEquals("", result);
  }

  public void testECI() throws ReaderException {
    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));
    assertEquals("", result);
  }

  // TODO definitely need more tests here

}
@@ -1352,35 +1352,122 @@
 sertEquals(%22
-%22, result);
+%5Cu00a1%5Cu00a2%5Cu00a3%22, result); // this should be %22%22 if your editor character encoding matches mine!
 %0A  %7D%0A%0A  publ
@@ -1946,27 +1946,66 @@
 Equals(%22
-%22, result);
+%5Cu00ed%5Cu00f3%5Cu00fa%22, result); // should be like %22%22
 %0A  %7D%0A%0A  

Use unicode escapes to avoid apparent source file encoding issues here