aboutsummaryrefslogtreecommitdiffstats
path: root/Test
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2014-12-23 12:27:38 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2014-12-23 12:29:19 +0100
commit2f875ea9e067b7d87d5405d985a9b554f6b4ea70 (patch)
tree61f212f6d4d622e1b3137533b00c1d336fc38387 /Test
parentf17b1aaf6e8376ffaa57e0ae023efc6ace423735 (diff)
downloadUstring-2f875ea9e067b7d87d5405d985a9b554f6b4ea70.zip
Ustring-2f875ea9e067b7d87d5405d985a9b554f6b4ea70.tar.gz
Ustring-2f875ea9e067b7d87d5405d985a9b554f6b4ea70.tar.bz2
Tests are green now.
Diffstat (limited to 'Test')
-rw-r--r--Test/Unit/.String.php.swpbin40960 -> 0 bytes
-rw-r--r--Test/Unit/String.php63
2 files changed, 61 insertions, 2 deletions
diff --git a/Test/Unit/.String.php.swp b/Test/Unit/.String.php.swp
deleted file mode 100644
index 211ddd9..0000000
--- a/Test/Unit/.String.php.swp
+++ /dev/null
Binary files differ
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 ( ) {