Annotation of embedaddon/php/ext/gmp/tests/026.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: gmp_cmp() basic tests
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("gmp")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: var_dump(gmp_cmp(123123,-123123));
! 9: var_dump(gmp_cmp("12345678900987654321","12345678900987654321"));
! 10: var_dump(gmp_cmp("12345678900987654321","123456789009876543211"));
! 11: var_dump(gmp_cmp(0,0));
! 12: var_dump(gmp_cmp(1231222,0));
! 13: var_dump(gmp_cmp(0,345355));
! 14:
! 15: $n = gmp_init("827278512385463739");
! 16: var_dump(gmp_cmp(0,$n) < 0);
! 17: $n1 = gmp_init("827278512385463739");
! 18: var_dump(gmp_cmp($n1,$n));
! 19:
! 20: var_dump(gmp_cmp($n1,$n,1));
! 21: var_dump(gmp_cmp(array(),array()));
! 22: var_dump(gmp_cmp(array()));
! 23: var_dump(gmp_cmp());
! 24:
! 25: echo "Done\n";
! 26: ?>
! 27: --EXPECTF--
! 28: int(2)
! 29: int(0)
! 30: int(-1)
! 31: int(0)
! 32: int(1)
! 33: int(-1)
! 34: bool(true)
! 35: int(0)
! 36:
! 37: Warning: gmp_cmp() expects exactly 2 parameters, 3 given in %s on line %d
! 38: NULL
! 39:
! 40: Warning: gmp_cmp(): Unable to convert variable to GMP - wrong type in %s on line %d
! 41: bool(false)
! 42:
! 43: Warning: gmp_cmp() expects exactly 2 parameters, 1 given in %s on line %d
! 44: NULL
! 45:
! 46: Warning: gmp_cmp() expects exactly 2 parameters, 0 given in %s on line %d
! 47: NULL
! 48: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>