Annotation of embedaddon/php/ext/gmp/tests/021.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: gmp_gcd() basic tests
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("gmp")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: var_dump(gmp_strval(gmp_gcd(234,12387)));
! 9: var_dump(gmp_strval(gmp_gcd(0,12387)));
! 10: var_dump(gmp_strval(gmp_gcd(224,0)));
! 11: var_dump(gmp_strval(gmp_gcd(-1,0)));
! 12: var_dump(gmp_strval(gmp_gcd(-1,0)));
! 13: var_dump(gmp_strval(gmp_gcd("12371238123","32618723123")));
! 14: var_dump(gmp_strval(gmp_gcd("7623456735","12372341234")));
! 15:
! 16: $n = gmp_init("8127346234");
! 17: var_dump(gmp_strval(gmp_gcd($n,"12372341234")));
! 18: $n = gmp_init("8127346234");
! 19: var_dump(gmp_strval(gmp_gcd("7623456735",$n)));
! 20: $n = gmp_init("8127346234");
! 21: var_dump(gmp_strval(gmp_gcd($n,$n)));
! 22: $n = gmp_init("8127346234");
! 23: var_dump(gmp_strval(gmp_gcd($n,0)));
! 24: var_dump(gmp_gcd($n,$n,1));
! 25: var_dump(gmp_gcd($n,array(),1));
! 26: var_dump(gmp_gcd(array(),$n,1));
! 27:
! 28: echo "Done\n";
! 29: ?>
! 30: --EXPECTF--
! 31: string(1) "3"
! 32: string(5) "12387"
! 33: string(3) "224"
! 34: string(1) "1"
! 35: string(1) "1"
! 36: string(1) "1"
! 37: string(1) "1"
! 38: string(1) "2"
! 39: string(1) "1"
! 40: string(10) "8127346234"
! 41: string(10) "8127346234"
! 42:
! 43: Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
! 44: NULL
! 45:
! 46: Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
! 47: NULL
! 48:
! 49: Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
! 50: NULL
! 51: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>