diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/url/base64_encode_basic_002.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/url/base64_encode_basic_002.phpt')
-rw-r--r-- | ext/standard/tests/url/base64_encode_basic_002.phpt | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ext/standard/tests/url/base64_encode_basic_002.phpt b/ext/standard/tests/url/base64_encode_basic_002.phpt new file mode 100644 index 0000000..cff8f41 --- /dev/null +++ b/ext/standard/tests/url/base64_encode_basic_002.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test base64_encode() function : basic functionality - check algorithm round trips +--FILE-- +<?php +/* Prototype : proto string base64_encode(string str) + * Description: Encodes string using MIME base64 algorithm + * Source code: ext/standard/base64.c + * Alias to functions: + */ + +/* + * Test base64_encode with single byte values. + */ + +echo "*** Testing base64_encode() : basic functionality ***\n"; + +$values = array( + "Hello World", + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]", + "\n\t Line with control characters\r\n", + "\xC1\xC2\xC3\xC4\xC5\xC6", + "\75\76\77\78\79\80" +); + +echo "\n--- Testing base64_encode() with binary string input ---\n"; + +$counter = 1; +foreach($values as $str) { + echo "-- Iteration $counter --\n"; + + $enc = base64_encode($str); + $dec = base64_decode($enc); + + if ($dec != $str) { + echo "TEST FAILED\n"; + } else { + echo "TEST PASSED\n"; + } + + $counter ++; +} + +?> +===Done=== +--EXPECTF-- +*** Testing base64_encode() : basic functionality *** + +--- Testing base64_encode() with binary string input --- +-- Iteration 1 -- +TEST PASSED +-- Iteration 2 -- +TEST PASSED +-- Iteration 3 -- +TEST PASSED +-- Iteration 4 -- +TEST PASSED +-- Iteration 5 -- +TEST PASSED +===Done=== |