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)
3737 var csa1 = asciiBytes . Length > 0
3838 ? Code128Code . CodesetAllowedForChar ( asciiBytes [ 0 ] )
3939 : Code128Code . CodeSetAllowed . CodeAorB ;
40- var csa2 = asciiBytes . Length > 0
40+ var csa2 = asciiBytes . Length > 1
4141 ? Code128Code . CodesetAllowedForChar ( asciiBytes [ 1 ] )
4242 : Code128Code . CodeSetAllowed . CodeAorB ;
4343 var currentCodeSet = this . GetBestStartSet ( csa1 , csa2 ) ;
Original file line number Diff line number Diff line change @@ -372,5 +372,17 @@ public void FullStringTest()
372372 result = content . Codes ;
373373 Assert . AreEqual ( 10 , result . Length , "Wrong number of code values in result" ) ;
374374 }
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+ }
375387 }
376388}
You can’t perform that action at this time.
0 commit comments