File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ private int[] StringToCode128(string asciiData)
37
37
var csa1 = asciiBytes . Length > 0
38
38
? Code128Code . CodesetAllowedForChar ( asciiBytes [ 0 ] )
39
39
: Code128Code . CodeSetAllowed . CodeAorB ;
40
- var csa2 = asciiBytes . Length > 0
40
+ var csa2 = asciiBytes . Length > 1
41
41
? Code128Code . CodesetAllowedForChar ( asciiBytes [ 1 ] )
42
42
: Code128Code . CodeSetAllowed . CodeAorB ;
43
43
var currentCodeSet = this . GetBestStartSet ( csa1 , csa2 ) ;
Original file line number Diff line number Diff line change @@ -372,5 +372,17 @@ public void FullStringTest()
372
372
result = content . Codes ;
373
373
Assert . AreEqual ( 10 , result . Length , "Wrong number of code values in result" ) ;
374
374
}
375
+
376
+ [ Test ]
377
+ public void OneCharStringTest ( )
378
+ {
379
+ var content = new Code128Content ( "0" ) ;
380
+ var result = content . Codes ;
381
+ Assert . AreEqual ( 4 , result . Length , "Wrong number of code values in result" ) ;
382
+ Assert . AreEqual ( 104 , result [ 0 ] , "Start code wrong" ) ;
383
+ Assert . AreEqual ( 16 , result [ 1 ] , "Code value #1 wrong" ) ;
384
+ Assert . AreEqual ( 17 , result [ 2 ] , "Checksum wrong" ) ;
385
+ Assert . AreEqual ( 106 , result [ 3 ] , "Stop character wrong" ) ;
386
+ }
375
387
}
376
388
}
You can’t perform that action at this time.
0 commit comments