diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2014-12-23 12:27:38 +0100 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2014-12-23 12:29:19 +0100 |
commit | 2f875ea9e067b7d87d5405d985a9b554f6b4ea70 (patch) | |
tree | 61f212f6d4d622e1b3137533b00c1d336fc38387 /Test/Unit | |
parent | f17b1aaf6e8376ffaa57e0ae023efc6ace423735 (diff) | |
download | Ustring-2f875ea9e067b7d87d5405d985a9b554f6b4ea70.zip Ustring-2f875ea9e067b7d87d5405d985a9b554f6b4ea70.tar.gz Ustring-2f875ea9e067b7d87d5405d985a9b554f6b4ea70.tar.bz2 |
Tests are green now.
Diffstat (limited to 'Test/Unit')
-rw-r--r-- | Test/Unit/.String.php.swp | bin | 40960 -> 0 bytes | |||
-rw-r--r-- | Test/Unit/String.php | 63 |
2 files changed, 61 insertions, 2 deletions
diff --git a/Test/Unit/.String.php.swp b/Test/Unit/.String.php.swp Binary files differdeleted file mode 100644 index 211ddd9..0000000 --- a/Test/Unit/.String.php.swp +++ /dev/null diff --git a/Test/Unit/String.php b/Test/Unit/String.php index c69acba..63186bc 100644 --- a/Test/Unit/String.php +++ b/Test/Unit/String.php @@ -753,6 +753,25 @@ class String extends Test\Unit\Suite { public function case_from_code ( ) { $this + // U+0000 to U+007F + ->when($result = LUT::fromCode(0x7e)) + ->then + ->string($result) + ->isEqualTo('~') + + // U+0080 to U+07FF + ->when($result = LUT::fromCode(0xa7)) + ->then + ->string($result) + ->isEqualTo('§') + + // U+0800 to U+FFFF + ->when($result = LUT::fromCode(0x1207)) + ->then + ->string($result) + ->isEqualTo('ሇ') + + // U+10000 to U+10FFFF ->when($result = LUT::fromCode(128169)) ->then ->string($result) @@ -761,18 +780,58 @@ class String extends Test\Unit\Suite { public function case_to_code ( ) { - /* $this + // U+0000 to U+007F + ->when($result = LUT::toCode('~')) + ->then + ->integer($result) + ->isEqualTo(0x7e) + + // U+0080 to U+07FF + ->when($result = LUT::toCode('§')) + ->then + ->integer($result) + ->isEqualTo(0xa7) + + // U+0800 to U+FFFF + ->when($result = LUT::toCode('ሇ')) + ->then + ->integer($result) + ->isEqualTo(0x1207) + + // U+10000 to U+10FFFF ->when($result = LUT::toCode('💩')) ->then ->integer($result) ->isEqualTo(128169); - */ } public function case_to_binary_code ( ) { + $this + // U+0000 to U+007F + ->when($result = LUT::toBinaryCode('~')) + ->then + ->string($result) + ->isEqualTo('00000000000000000000000001111110') + + // U+0080 to U+07FF + ->when($result = LUT::toBinaryCode('§')) + ->then + ->string($result) + ->isEqualTo('00000000000000000000000010100111') + // U+0800 to U+FFFF + ->when($result = LUT::toBinaryCode('ሇ')) + ->then + ->string($result) + ->isEqualTo('00000000000000000001001000000111') + + // U+10000 to U+10FFFF + ->when($result = LUT::toBinaryCode('💩')) + ->then + ->string($result) + ->isEqualTo('00000000000000011111010010101001'); } public function case_transcode_and_isUtf8 ( ) { |