Difference between revisions of "Testing"

From ProgClub
Jump to: navigation, search
Line 1: Line 1:
 
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.
 
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 ==
+
= Various =
  
 
* null
 
* null
Line 10: Line 10:
 
* new stdClass(), new DateTime()
 
* new stdClass(), new DateTime()
 
* []
 
* []
 +
 +
== Array (list) ==
 +
 
* [ null ]
 
* [ null ]
 
* [ true, false ]
 
* [ true, false ]
Line 16: Line 19:
 
* [ <nowiki>''</nowiki>, 'true', 'false', 'yes', 'no', 'maybe', '-1', '0', '1', '0.0', '0.1', '1.0' ]
 
* [ <nowiki>''</nowiki>, 'true', 'false', 'yes', 'no', 'maybe', '-1', '0', '1', '0.0', '0.1', '1.0' ]
 
* [ new stdClass(), new DateTime() ]
 
* [ new stdClass(), new DateTime() ]
 +
 +
== Array (map) ==
 +
 
* [ 'a' => null ]
 
* [ 'a' => null ]
 
* [ 'a' => true, 'b' => false ]
 
* [ 'a' => true, 'b' => false ]
Line 22: Line 28:
 
* [ 'a' => <nowiki>''</nowiki>, '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' ]
 
* [ 'a' => <nowiki>''</nowiki>, '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' ]
 
* [ 'a' => new stdClass(), 'b' => new DateTime() ]
 
* [ 'a' => new stdClass(), 'b' => new DateTime() ]
 +
 +
== Array (map with empty key) ==
 +
 
* [ <nowiki>''</nowiki> => null ]
 
* [ <nowiki>''</nowiki> => null ]
 
* [ <nowiki>''</nowiki> => true, 'b' => false ]
 
* [ <nowiki>''</nowiki> => true, 'b' => false ]
Line 28: Line 37:
 
* [ <nowiki>''</nowiki> => <nowiki>''</nowiki>, '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' ]
 
* [ <nowiki>''</nowiki> => <nowiki>''</nowiki>, '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' ]
 
* [ <nowiki>''</nowiki> => new stdClass(), 'b' => new DateTime() ]
 
* [ <nowiki>''</nowiki> => new stdClass(), 'b' => new DateTime() ]
 +
 +
= Integers =
  
 
== Positive 16-bit int ==
 
== Positive 16-bit int ==
Line 90: Line 101:
 
* -100000000000000000, -100000000000000001, -999999999999999999,
 
* -100000000000000000, -100000000000000001, -999999999999999999,
 
* -1000000000000000000, -1000000000000000001, -9223372036854775807, -9223372036854775808
 
* -1000000000000000000, -1000000000000000001, -9223372036854775807, -9223372036854775808
 +
 +
= Floats =
  
 
== Positive 32-bit floats ==
 
== Positive 32-bit floats ==

Revision as of 00:57, 5 August 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'
  • new stdClass(), new DateTime()
  • []

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() ]

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' => 'true', 'c' => 'false', 'd' => 'yes', 'e' => 'no', 'f' => 'maybe', 'g' => '-1', 'h' => '0', 'i' => '1', 'j' => '0.0', 'k' => '0.1', 'l' => '1.0' ]
  • [ 'a' => new stdClass(), 'b' => new DateTime() ]

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() ]

Integers

Positive 16-bit int

  • 0
  • 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

  • -0
  • -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

Positive 32-bit floats

Negative 32-bit floats

Positive 64-bit floats

Negative 64-bit floats