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