1afaab30015eb9404b41549653f0ada76f3db6f8
[zxing.git] / core / test / src / com / google / zxing / oned / rss / expanded / decoders / AnyAIDecoderTest.java
1 /*
2  * Copyright (C) 2010 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /* 
18  * These authors would like to acknowledge the Spanish Ministry of Industry,
19  * Tourism and Trade, for the support in the project TSI020301-2008-2
20  * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
21  * Mobile Dynamic Environments", led by Treelogic
22  * ( http://www.treelogic.com/ ):
23  *
24  *   http://www.piramidepse.com/
25  */
26
27 package com.google.zxing.oned.rss.expanded.decoders;
28
29 /**
30  * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
31  */
32 public class AnyAIDecoderTest extends AbstractDecoderTest {
33         
34         private static final String header           = ".....";
35                                                      
36         public void testAnyAIDecoder_1() throws Exception {
37                 String data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2numeric + numeric_12;
38                 String expected = "(10)12A12";
39                 
40                 assertCorrectBinaryString(data, expected);
41         }
42         
43         public void testAnyAIDecoder_2() throws Exception {
44                 String data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2isoiec646 + i646_B;
45                 String expected = "(10)12AB";
46                 
47                 assertCorrectBinaryString(data, expected);
48         }
49         
50         public void testAnyAIDecoder_3() throws Exception {
51                 String data = header + numeric_10 + numeric2alpha + alpha2isoiec646 + i646_B + i646_C + isoiec646_2alpha + alpha_A + alpha2numeric + numeric_10;
52                 String expected = "(10)BCA10";
53                 
54                 assertCorrectBinaryString(data, expected);
55         }
56         
57         public void testAnyAIDecoder_numericFNC1_secondDigit() throws Exception {
58                 String data = header + numeric_10 + numeric_1FNC1;
59                 String expected = "(10)1";
60                 
61                 assertCorrectBinaryString(data, expected);
62         }
63         
64         public void testAnyAIDecoder_alphaFNC1() throws Exception {
65                 String data = header + numeric_10 + numeric2alpha + alpha_A + alpha_FNC1;
66                 String expected = "(10)A";
67                 
68                 assertCorrectBinaryString(data, expected);
69         }
70         
71         public void testAnyAIDecoder_646FNC1() throws Exception {
72                 String data = header + numeric_10 + numeric2alpha + alpha_A + isoiec646_2alpha + i646_B + i646_FNC1;
73                 String expected = "(10)AB";
74                 
75                 assertCorrectBinaryString(data, expected);
76         }
77 }