Initial commit

This commit is contained in:
2026-08-30 22:02:02 +00:00
commit b6bd2277f5
2334 changed files with 646393 additions and 0 deletions
@@ -0,0 +1,78 @@
<?php
/**
* ATest.php
*
* @since 2015-02-21
* @category Library
* @package Barcode
* @author Nicola Asuni <info@tecnick.com>
* @copyright 2015-2026 Nicola Asuni - Tecnick.com LTD
* @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
* @link https://github.com/tecnickcom/tc-lib-barcode
*
* This file is part of tc-lib-barcode software library.
*/
namespace Test\Linear\CodeOneTwoEight;
use Test\TestUtil;
/**
* Barcode class test
*
* @since 2015-02-21
* @category Library
* @package Barcode
* @author Nicola Asuni <info@tecnick.com>
* @copyright 2015-2026 Nicola Asuni - Tecnick.com LTD
* @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
* @link https://github.com/tecnickcom/tc-lib-barcode
*/
class CodeOneTwoEightATest extends TestUtil
{
protected function getTestObject(): \Com\Tecnick\Barcode\Barcode
{
return new \Com\Tecnick\Barcode\Barcode();
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testGetGrid(): void
{
$barcode = $this->getTestObject();
$bobj = $barcode->getBarcodeObj('C128A', 'ABCDEFG');
$grid = $bobj->getGrid();
$expected =
'110100001001010001100010001011000100010001101011000100010001101000100011000101101'
. "0001000100110010001100011101011\n";
$this->assertEquals($expected, $grid);
$bobj = $barcode->getBarcodeObj('C128A', '0123456789');
$grid = $bobj->getGrid();
$expected =
'110100001001001110110010011100110110011100101100101110011001001110110111001001100'
. "1110100111011011101110100110011100101100111101110101100011101011\n";
$this->assertEquals($expected, $grid);
$bobj = $barcode->getBarcodeObj('C128A', \chr(241) . '01234567891');
$grid = $bobj->getGrid();
$expected =
'110100001001111010111010011101100100111001101100111001011001011100110010011101101'
. "11001001100111010011101101110111010011001110010110010011100110100001101001100011101011\n";
$this->assertEquals($expected, $grid);
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testInvalidInput(): void
{
$this->bcExpectException(\Com\Tecnick\Barcode\Exception::class);
$barcode = $this->getTestObject();
$barcode->getBarcodeObj('C128A', \chr(246) . '01234567891');
}
}
@@ -0,0 +1,71 @@
<?php
/**
* BTest.php
*
* @since 2015-02-21
* @category Library
* @package Barcode
* @author Nicola Asuni <info@tecnick.com>
* @copyright 2015-2026 Nicola Asuni - Tecnick.com LTD
* @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
* @link https://github.com/tecnickcom/tc-lib-barcode
*
* This file is part of tc-lib-barcode software library.
*/
namespace Test\Linear\CodeOneTwoEight;
use Test\TestUtil;
/**
* Barcode class test
*
* @since 2015-02-21
* @category Library
* @package Barcode
* @author Nicola Asuni <info@tecnick.com>
* @copyright 2015-2026 Nicola Asuni - Tecnick.com LTD
* @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
* @link https://github.com/tecnickcom/tc-lib-barcode
*/
class CodeOneTwoEightBTest extends TestUtil
{
protected function getTestObject(): \Com\Tecnick\Barcode\Barcode
{
return new \Com\Tecnick\Barcode\Barcode();
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testGetGrid(): void
{
$barcode = $this->getTestObject();
$bobj = $barcode->getBarcodeObj('C128B', '0123456789');
$grid = $bobj->getGrid();
$expected =
'11010010000100111011001001110011011001110010110010111001100100111011011100'
. "10011001110100111011011101110100110011100101100110000101001100011101011\n";
$this->assertEquals($expected, $grid);
$bobj = $barcode->getBarcodeObj('C128B', \chr(241) . '01234567891');
$grid = $bobj->getGrid();
$expected =
'11010010000111101011101001110110010011100110110011100101100101110011001001'
. "110110111001001100111010011101101110111010011001110010110010011100110100001100101100011101011\n";
$this->assertEquals($expected, $grid);
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testInvalidInput(): void
{
$this->bcExpectException(\Com\Tecnick\Barcode\Exception::class);
$barcode = $this->getTestObject();
$barcode->getBarcodeObj('C128B', \chr(246) . '01234567891');
}
}
@@ -0,0 +1,95 @@
<?php
/**
* CTest.php
*
* @since 2015-02-21
* @category Library
* @package Barcode
* @author Nicola Asuni <info@tecnick.com>
* @copyright 2015-2026 Nicola Asuni - Tecnick.com LTD
* @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
* @link https://github.com/tecnickcom/tc-lib-barcode
*
* This file is part of tc-lib-barcode software library.
*/
namespace Test\Linear\CodeOneTwoEight;
use Test\TestUtil;
/**
* Barcode class test
*
* @since 2015-02-21
* @category Library
* @package Barcode
* @author Nicola Asuni <info@tecnick.com>
* @copyright 2015-2026 Nicola Asuni - Tecnick.com LTD
* @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
* @link https://github.com/tecnickcom/tc-lib-barcode
*/
class CodeOneTwoEightCTest extends TestUtil
{
protected function getTestObject(): \Com\Tecnick\Barcode\Barcode
{
return new \Com\Tecnick\Barcode\Barcode();
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testGetGrid(): void
{
$barcode = $this->getTestObject();
$bobj = $barcode->getBarcodeObj('C128C', '0123456789');
$grid = $bobj->getGrid();
$expected = "110100111001100110110011101101110101110110001000010110011011011110100001101001100011101011\n";
$this->assertEquals($expected, $grid);
$bobj = $barcode->getBarcodeObj('C128C', \chr(241) . '0123456789');
$grid = $bobj->getGrid();
$expected =
'11010011100111101011101100110110011101101110101110110001000010110011011011110111101101101100'
. "011101011\n";
$this->assertEquals($expected, $grid);
$bobj = $barcode->getBarcodeObj('C128C', \chr(241) . '00123456780000000001');
$grid = $bobj->getGrid();
$expected =
'11010011100111101011101101100110010110011100100010110001110001011011000010100110110011001101'
. "1001100110110011001101100110011001101100100010011001100011101011\n";
$this->assertEquals($expected, $grid);
$bobj = $barcode->getBarcodeObj('C128C', \chr(241) . '42029651' . \chr(241) . '9405510200864168997758');
$grid = $bobj->getGrid();
$expected =
'11010011100111101011101011011100011001100110101111000101101110100011110101110100010111101000'
. '100110011011101000110011001101101100110011110100100110001000101000010011010111011110111101110101110'
. "1100010111100101001100011101011\n";
$this->assertEquals($expected, $grid);
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testInvalidLength(): void
{
$this->bcExpectException(\Com\Tecnick\Barcode\Exception::class);
$barcode = $this->getTestObject();
$barcode->getBarcodeObj('C128C', '12345678901');
}
/**
* @throws \Com\Tecnick\Barcode\Exception
* @throws \Com\Tecnick\Color\Exception
*/
public function testInvalidChar(): void
{
$this->bcExpectException(\Com\Tecnick\Barcode\Exception::class);
$barcode = $this->getTestObject();
$barcode->getBarcodeObj('C128C', '1A2345678901');
}
}