Difference between revisions of "Testing"
From ProgClub
Line 26: | Line 26: | ||
* /* high punctuation */ '[', '\\', ']', '^', '_', '`', | * /* high punctuation */ '[', '\\', ']', '^', '_', '`', | ||
* /* end punctuation */ '{', '|', '}', '~', | * /* end punctuation */ '{', '|', '}', '~', | ||
− | + | * /* non-breaking spaces */ "\xc2\xa0", "A\xc2\xa0B\xc2\xa0C", | |
− | |||
TODO: list all language names in their native tongue. | TODO: list all language names in their native tongue. |
Revision as of 00:35, 23 September 2019
The purpose of this page is to collect values for use in automated testing. The focus is PHP, so there are only signed integers. The sister library to these notes is PHPBOM, we use some of its constants below.
Various
- null,
- true, false,
- 0, ~0, ~1,
- 0.0, -0.0, -0.1, 0.1, BOM_NEG_INF, BOM_POS_INF, BOM_NAN,
- '', ' ', 'true', 'false', 'yes', 'no', 'maybe', '-1', '0', '1', '0.0', '0.1', '1.0',
- "\x00",
- "\t", "\t\t", "1\t2\t3\t4",
- "\n", "\n\n", "1\n2\n3\n",
- "\n1", "\n\n2", "\n\n\n3",
- "\r\n", "\r\n\r\n", "1\r\n2\r\n3\r\n",
- "\r", "\r\n\n", "1\r\n2\n3\r\n",
- "1\t2\t3\t4\n5\t6\t7\t8\n9\t10\t11\t12",
- "1\t2\t3\t4\n5\t6\t7\t8\n9\t10\t11\t12\n",
- '日本語', '¯\_(ツ)_/¯',
- new stdClass(), new DateTime(),
- function( $val ) { return $val; },
Strings
- /* low punctuation */ ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/',
- /* mid punctuation */ ':', ';', '<', '=', '>', '?', '@',
- /* high punctuation */ '[', '\\', ']', '^', '_', '`',
- /* end punctuation */ '{', '|', '}', '~',
- /* non-breaking spaces */ "\xc2\xa0", "A\xc2\xa0B\xc2\xa0C",
TODO: list all language names in their native tongue.
TODO: list all country names in a map using the native tongue, e.g. [ 'au' => 'Australia', ... ]
TODO: test inclusion of Byte Order Marks (BOM).
TODO: test ASCII control chars and x00.
TODO: combining diacritics
TODO: objects that implement __toString()
TODO: objects that don't implement __toString() (should fail)
Arrays
Array (list)
- [],
- [ null ],
- [ true, false ],
- [ 0, ~0, ~1 ],
- [ 0.0, -0.0, -0.1, 0.1, BOM_NEG_INF, BOM_POS_INF, BOM_NAN ],
- [ '', ' ', 'true', 'false', 'yes', 'no', 'maybe', '-1', '0', '1', '0.0', '0.1', '1.0' ],
- [ new stdClass(), new DateTime() ],
- [ function( $val ) { return $val; } ],
Array (map)
- [ 'a' => null ],
- [ 'a' => true, 'b' => false ],
- [ 'a' => 0, 'b' => ~0, 'c' => ~1 ],
- [ 'a' => 0.0, 'b' => -0.0, 'c' => -0.1, 'd' => 0.1, 'e' => BOM_INF_NEG, 'f' => BOM_INF_POS, 'g' => BOM_NAN ],
- [ 'a' => '', 'b' => ' ', 'c' => 'true', 'd' => 'false', 'e' => 'yes', 'f' => 'no', 'g' => 'maybe', 'h' => '-1', 'i' => '0', 'j' => '1', 'k' => '0.0', 'l' => '0.1', 'm' => '1.0' ],
- [ 'a' => new stdClass(), 'b' => new DateTime() ],
- [ 'a' => function( $val ) { return $val; } ],
Array (map with empty key)
- [ '' => null ],
- [ '' => true, 'b' => false ],
- [ '' => 0, 'b' => ~0, 'c' => ~1 ],
- [ '' => 0.0, 'b' => -0.0, 'c' => -0.1, 'd' => 0.1, 'e' => BOM_INF_NEG, 'f' => BOM_INF_POS, 'g' => BOM_NAN ],
- [ '' => '', 'b' => 'true', 'c' => 'false', 'd' => 'yes', 'e' => 'no', 'f' => 'maybe', 'g' => '-1', 'h' => '0', 'i' => '1', 'j' => '0.0', 'k' => '0.1', 'l' => '1.0' ],
- [ '' => new stdClass(), 'b' => new DateTime() ],
- [ '' => function( $val ) { return $val; } ],
Array (map with space key)
- [ ' ' => null ],
- [ ' ' => true, 'b' => false ],
- [ ' ' => 0, 'b' => ~0, 'c' => ~1 ],
- [ ' ' => 0.0, 'b' => -0.0, 'c' => -0.1, 'd' => 0.1, 'e' => BOM_INF_NEG, 'f' => BOM_INF_POS, 'g' => BOM_NAN ],
- [ ' ' => '', 'b' => ' ', 'c' => 'true', 'd' => 'false', 'e' => 'yes', 'f' => 'no', 'g' => 'maybe', 'h' => '-1', 'i' => '0', 'j' => '1', 'k' => '0.0', 'l' => '0.1', 'm' => '1.0' ],
- [ ' ' => new stdClass(), 'b' => new DateTime() ],
- [ ' ' => function( $val ) { return $val; } ],
Array (weird keys)
- [ null => 'null', ],
- [ true => 'true', ],
- [ false => 'false', ],
- [ null => 'null', true => 'true', ],
- [ null => 'null', false => 'false', ],
- [ null => 'null', true => 'true', false => 'false', ],
Integers
Zero (int)
- 0,
Positive 16-bit int
- 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 15, 16, 17, 31, 32, 33, 37, 42, 63, 64, 65, 69, 73, 99,
- 100, 101, 127, 128, 129, 199, 200, 201, 255, 256, 257, 499, 500, 501, 511, 512, 513, 999,
- 1000, 1001, 1023, 1024, 1025, 1337, 2047, 2048, 2049, 4095, 4096, 4097, 4999, 5000, 5001, 8191, 8192, 8193, 9999,
- 10000, 10001, 16383, 16384, 16385, 19999, 20000, 20001, 32767,
Negative 16-bit int
- -1, -2, -3, -4, -5, -6, -7, -8, -9,
- -10, -11, -12, -13, -15, -16, -17, -31, -32, -33, -37, -42, -63, -64, -65, -69, -73, -99,
- -100, -101, -127, -128, -129, -199, -200, -201, -255, -256, -257, -499, -500, -501, -511, -512, -513, -999,
- -1000, -1001, -1023, -1024, -1025, -1337, -2047, -2048, -2049, -4095, -4096, -4097, -4999, -5000, -5001, -8191, -8192, -8193, -9999,
- -10000, -10001, -16383, -16384, -16385, -19999, -20000, -20001, -32767, -32768,
Positive 32-bit int
- 32768, 32769, 49999, 50000, 50001, 65535, 65536, 65537, 99999,
- 100000, 100001, 131071, 131072, 131073, 199999, 200000, 200001, 262143, 262144, 262145, 299999, 300000, 300001, 524287, 524288, 524289, 999999,
- 1000000, 1000001, 1048575, 1048576, 1048577, 1999999, 2000000, 2000001, 2097151, 2097152, 2097153, 2999999, 3000000, 3000001, 3999999, 4000000, 4000001, 4194303, 4194304, 4194305, 4999999, 5000000, 5000001, 8388607, 8388608, 8388609, 9999999,
- 10000000, 10000001, 16777215, 16777216, 16777217, 33554431, 33554432, 33554433, 67108863, 67108864, 67108865, 99999999,
- 100000000, 100000001, 134217727, 134217728, 134217729, 268435455, 268435456, 268435457, 536870911, 536870912, 536870913, 999999999,
- 1000000000, 1000000001, 1073741823, 1073741824, 1073741825, 2147483647,
Negative 32-bit int
- -32769, -49999, -50000, -50001, -65535, -65536, -65537, -99999,
- -100000, -100001, -131071, -131072, -131073, -199999, -200000, -200001, -262143, -262144, -262145, -299999, -300000, -300001, -524287, -524288, -524289, -999999,
- -1000000, -1000001, -1048575, -1048576, -1048577, -1999999, -2000000, -2000001, -2097151, -2097152, -2097153, -2999999, -3000000, -3000001, -3999999, -4000000, -4000001, -4194303, -4194304, -4194305, -4999999, -5000000, -5000001, -8388607, -8388608, -8388609, -9999999,
- -10000000, -10000001, -16777215, -16777216, -16777217, -33554431, -33554432, -33554433, -67108863, -67108864, -67108865, -99999999,
- -100000000, -100000001, -134217727, -134217728, -134217729, -268435455, -268435456, -268435457, -536870911, -536870912, -536870913, -999999999,
- -1000000000, -1000000001, -1073741823, -1073741824, -1073741825, -2147483647, -2147483648,
Positive 64-bit int
- 2147483648, 2147483649, 4294967295, 4294967296, 4294967297, 8589934591, 8589934592, 8589934593, 9999999999,
- 10000000000, 10000000001, 17179869183, 17179869184, 17179869185, 34359738367, 34359738368, 34359738369, 68719476735, 68719476736, 68719476737, 99999999999,
- 100000000000, 100000000001, 137438953471, 137438953472, 137438953473, 274877906943, 274877906944, 274877906945, 549755813887, 549755813888, 549755813889, 999999999999,
- 1000000000000, 1000000000001, 9999999999999,
- 10000000000000, 10000000000001, 99999999999999,
- 100000000000000, 100000000000001, 999999999999999,
- 1000000000000000, 1000000000000001, 9999999999999999,
- 10000000000000000, 10000000000000001, 99999999999999999,
- 100000000000000000, 100000000000000001, 999999999999999999,
- 1000000000000000000, 1000000000000000001, 9223372036854775807,
Negative 64-bit int
- -2147483649, -4294967295, -4294967296, -4294967297, -8589934591, -8589934592, -8589934593, -9999999999,
- -10000000000, -10000000001, -17179869183, -17179869184, -17179869185, -34359738367, -34359738368, -34359738369, -68719476735, -68719476736, -68719476737, -99999999999,
- -100000000000, -100000000001, -137438953471, -137438953472, -137438953473, -274877906943, -274877906944, -274877906945, -549755813887, -549755813888, -549755813889, -999999999999,
- -1000000000000, -1000000000001, -9999999999999,
- -10000000000000, -10000000000001, -99999999999999,
- -100000000000000, -100000000000001, -999999999999999,
- -1000000000000000, -1000000000000001, -9999999999999999,
- -10000000000000000, -10000000000000001, -99999999999999999,
- -100000000000000000, -100000000000000001, -999999999999999999,
- -1000000000000000000, -1000000000000000001, -9223372036854775807, -9223372036854775808,
Floats
Zero (float)
- 0.0,
- -0.0,