Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/Data/AlphaNumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ public static function stringValidateProvider():array{
['ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:', true],
['abc', false],
['ÄÖÜ', false],
[',', true],
[',', false],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think perhaps the tests should actually try to generate a QR with this data too. As it will crash in AlphaNum::ord(). Would have revealed this bug earlier.

Copy link
Contributor Author

@eigan eigan Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataInterfaceTestAbstract

	public function testValidateString(string $string, bool $expected):void{
		$this::assertSame($expected, $this->dataMode::validateString($string));

		try {
			$qrCode      = new QRCode;
			$qrCode->addSegment(static::getDataModeInterface($string));
			$qrCode->renderMatrix($qrCode->getQRMatrix());
			self::assertTrue($expected);
		} catch(\Exception){
			self::assertFalse($expected);
		}
	}

This can also reveal the real bug while in main.

['-', true],
['+', true],
['.', true],
['*', true],
[':', true],
['/', true],
['\\', false],
['0,1', false]
];
}

Expand Down
Loading