!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/multirest.picotech.app/public_html/vendor/bacon/bacon-qr-code/test/Encoder/   drwxr-xr-x
Free 28.21 GB of 117.98 GB (23.91%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     MatrixUtilTest.php (15.06 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
declare(strict_types 1);

namespace 
BaconQrCodeTest\Encoder;

use 
BaconQrCode\Common\BitArray;
use 
BaconQrCode\Common\ErrorCorrectionLevel;
use 
BaconQrCode\Common\Version;
use 
BaconQrCode\Encoder\ByteMatrix;
use 
BaconQrCode\Encoder\MatrixUtil;
use 
PHPUnit\Framework\TestCase;
use 
ReflectionClass;
use 
ReflectionMethod;

class 
MatrixUtilTest extends TestCase
{
    
/**
     * @var ReflectionMethod[]
     */
    
protected $methods = [];

    public function 
setUp() : void
    
{
        
// Hack to be able to test protected methods
        
$reflection = new ReflectionClass(MatrixUtil::class);

        foreach (
$reflection->getMethods(ReflectionMethod::IS_STATIC) as $method) {
            
$method->setAccessible(true);
            
$this->methods[$method->getName()] = $method;
        }
    }

    public function 
testToString() : void
    
{
        
$matrix = new ByteMatrix(33);
        
$matrix->set(000);
        
$matrix->set(101);
        
$matrix->set(200);
        
$matrix->set(011);
        
$matrix->set(110);
        
$matrix->set(211);
        
$matrix->set(02, -1);
        
$matrix->set(12, -1);
        
$matrix->set(22, -1);

        
$expected " 0 1 0\n 1 0 1\n      \n";
        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testClearMatrix() : void
    
{
        
$matrix = new ByteMatrix(22);
        
MatrixUtil::clearMatrix($matrix);

        
$this->assertSame(-1$matrix->get(00));
        
$this->assertSame(-1$matrix->get(10));
        
$this->assertSame(-1$matrix->get(01));
        
$this->assertSame(-1$matrix->get(11));
    }

    public function 
testEmbedBasicPatterns1() : void
    
{
        
$matrix = new ByteMatrix(2121);
        
MatrixUtil::clearMatrix($matrix);
        
$this->methods['embedBasicPatterns']->invoke(
            
null,
            
Version::getVersionForNumber(1),
            
$matrix
        
);
        
$expected " 1 1 1 1 1 1 1 0           0 1 1 1 1 1 1 1\n"
                  
" 1 0 0 0 0 0 1 0           0 1 0 0 0 0 0 1\n"
                  
" 1 0 1 1 1 0 1 0           0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0           0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0           0 1 0 1 1 1 0 1\n"
                  
" 1 0 0 0 0 0 1 0           0 1 0 0 0 0 0 1\n"
                  
" 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
                  
" 0 0 0 0 0 0 0 0           0 0 0 0 0 0 0 0\n"
                  
"             1                            \n"
                  
"             0                            \n"
                  
"             1                            \n"
                  
"             0                            \n"
                  
"             1                            \n"
                  
" 0 0 0 0 0 0 0 0 1                        \n"
                  
" 1 1 1 1 1 1 1 0                          \n"
                  
" 1 0 0 0 0 0 1 0                          \n"
                  
" 1 0 1 1 1 0 1 0                          \n"
                  
" 1 0 1 1 1 0 1 0                          \n"
                  
" 1 0 1 1 1 0 1 0                          \n"
                  
" 1 0 0 0 0 0 1 0                          \n"
                  
" 1 1 1 1 1 1 1 0                          \n";

        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testEmbedBasicPatterns2() : void
    
{
        
$matrix = new ByteMatrix(2525);
        
MatrixUtil::clearMatrix($matrix);
        
$this->methods['embedBasicPatterns']->invoke(
            
null,
            
Version::getVersionForNumber(2),
            
$matrix
        
);
        
$expected " 1 1 1 1 1 1 1 0                   0 1 1 1 1 1 1 1\n"
                  
" 1 0 0 0 0 0 1 0                   0 1 0 0 0 0 0 1\n"
                  
" 1 0 1 1 1 0 1 0                   0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0                   0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0                   0 1 0 1 1 1 0 1\n"
                  
" 1 0 0 0 0 0 1 0                   0 1 0 0 0 0 0 1\n"
                  
" 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
                  
" 0 0 0 0 0 0 0 0                   0 0 0 0 0 0 0 0\n"
                  
"             1                                    \n"
                  
"             0                                    \n"
                  
"             1                                    \n"
                  
"             0                                    \n"
                  
"             1                                    \n"
                  
"             0                                    \n"
                  
"             1                                    \n"
                  
"             0                                    \n"
                  
"             1                   1 1 1 1 1        \n"
                  
" 0 0 0 0 0 0 0 0 1               1 0 0 0 1        \n"
                  
" 1 1 1 1 1 1 1 0                 1 0 1 0 1        \n"
                  
" 1 0 0 0 0 0 1 0                 1 0 0 0 1        \n"
                  
" 1 0 1 1 1 0 1 0                 1 1 1 1 1        \n"
                  
" 1 0 1 1 1 0 1 0                                  \n"
                  
" 1 0 1 1 1 0 1 0                                  \n"
                  
" 1 0 0 0 0 0 1 0                                  \n"
                  
" 1 1 1 1 1 1 1 0                                  \n";

        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testEmbedTypeInfo() : void
    
{
        
$matrix = new ByteMatrix(2121);
        
MatrixUtil::clearMatrix($matrix);
        
$this->methods['embedTypeInfo']->invoke(
            
null,
            
ErrorCorrectionLevel::M(),
            
5,
            
$matrix
        
);
        
$expected "                 0                        \n"
                  
"                 1                        \n"
                  
"                 1                        \n"
                  
"                 1                        \n"
                  
"                 0                        \n"
                  
"                 0                        \n"
                  
"                                          \n"
                  
"                 1                        \n"
                  
" 1 0 0 0 0 0   0 1         1 1 0 0 1 1 1 0\n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                 0                        \n"
                  
"                 0                        \n"
                  
"                 0                        \n"
                  
"                 0                        \n"
                  
"                 0                        \n"
                  
"                 0                        \n"
                  
"                 1                        \n";

        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testEmbedVersionInfo() : void
    
{
        
$matrix = new ByteMatrix(2121);
        
MatrixUtil::clearMatrix($matrix);
        
$this->methods['maybeEmbedVersionInfo']->invoke(
            
null,
            
Version::getVersionForNumber(7),
            
$matrix
        
);
        
$expected "                     0 0 1                \n"
                  
"                     0 1 0                \n"
                  
"                     0 1 0                \n"
                  
"                     0 1 1                \n"
                  
"                     1 1 1                \n"
                  
"                     0 0 0                \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
" 0 0 0 0 1 0                              \n"
                  
" 0 1 1 1 1 0                              \n"
                  
" 1 0 0 1 1 0                              \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n"
                  
"                                          \n";

        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testEmbedDataBits() : void
    
{
        
$matrix = new ByteMatrix(2121);
        
MatrixUtil::clearMatrix($matrix);
        
$this->methods['embedBasicPatterns']->invoke(
            
null,
            
Version::getVersionForNumber(1),
            
$matrix
        
);

        
$bits = new BitArray();
        
$this->methods['embedDataBits']->invoke(
            
null,
            
$bits,
            -
1,
            
$matrix
        
);

        
$expected " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n"
                  
" 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
                  
" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
                  
" 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n";

        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testBuildMatrix() : void
    
{
        
$bytes = [
            
32652056941220461282364215974221244169,
            
23915013870237852249674219 61
        
];
        
$bits = new BitArray();

        foreach (
$bytes as $byte) {
            
$bits->appendBits($byte8);
        }

        
$matrix = new ByteMatrix(2121);
        
MatrixUtil::buildMatrix(
            
$bits,
            
ErrorCorrectionLevel::H(),
            
Version::getVersionForNumber(1),
            
3,
            
$matrix
        
);

        
$expected " 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n"
                  
" 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1\n"
                  
" 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1\n"
                  
" 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1\n"
                  
" 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
                  
" 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0\n"
                  
" 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0\n"
                  
" 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0\n"
                  
" 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0\n"
                  
" 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 0\n"
                  
" 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1\n"
                  
" 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 1\n"
                  
" 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0\n"
                  
" 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1\n"
                  
" 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0\n"
                  
" 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0\n"
                  
" 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0\n"
                  
" 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0\n";

        
$this->assertSame($expected, (string) $matrix);
    }

    public function 
testFindMsbSet() : void
    
{
        
$this->assertSame(0$this->methods['findMsbSet']->invoke(null0));
        
$this->assertSame(1$this->methods['findMsbSet']->invoke(null1));
        
$this->assertSame(8$this->methods['findMsbSet']->invoke(null0x80));
        
$this->assertSame(32$this->methods['findMsbSet']->invoke(null0x80000000));
    }

    public function 
testCalculateBchCode() : void
    
{
        
// Encoding of type information.
        // From Appendix C in JISX0510:2004 (p 65)
        
$this->assertSame(0xdc$this->methods['calculateBchCode']->invoke(null50x537));
        
// From http://www.swetake.com/qr/qr6.html
        
$this->assertSame(0x1c2$this->methods['calculateBchCode']->invoke(null0x130x537));
        
// From http://www.swetake.com/qr/qr11.html
        
$this->assertSame(0x214$this->methods['calculateBchCode']->invoke(null0x1b0x537));

        
// Encoding of version information.
        // From Appendix D in JISX0510:2004 (p 68)
        
$this->assertSame(0xc94$this->methods['calculateBchCode']->invoke(null70x1f25));
        
$this->assertSame(0x5bc$this->methods['calculateBchCode']->invoke(null80x1f25));
        
$this->assertSame(0xa99$this->methods['calculateBchCode']->invoke(null90x1f25));
        
$this->assertSame(0x4d3$this->methods['calculateBchCode']->invoke(null100x1f25));
        
$this->assertSame(0x9a6$this->methods['calculateBchCode']->invoke(null200x1f25));
        
$this->assertSame(0xd75$this->methods['calculateBchCode']->invoke(null300x1f25));
        
$this->assertSame(0xc69$this->methods['calculateBchCode']->invoke(null400x1f25));
    }

    public function 
testMakeVersionInfoBits() : void
    
{
        
// From Appendix D in JISX0510:2004 (p 68)
        
$bits = new BitArray();
        
$this->methods['makeVersionInfoBits']->invoke(nullVersion::getVersionForNumber(7), $bits);
        
$this->assertSame(' ...XXXXX ..X..X.X ..', (string) $bits);
    }

    public function 
testMakeTypeInfoBits() : void
    
{
        
// From Appendix D in JISX0510:2004 (p 68)
        
$bits = new BitArray();
        
$this->methods['makeTypeInfoBits']->invoke(nullErrorCorrectionLevel::M(), 5$bits);
        
$this->assertSame(' X......X X..XXX.', (string) $bits);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0243 ]--