Annotation of embedaddon/php/ext/gmp/tests/bug50283.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Feature Request #50283 (allow base in gmp_strval to use full range: 2 to 62, and -2 to -36)
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("gmp")) print "skip"; ?>
! 5: <?php if (version_compare(GMP_VERSION, "4.2.0", "<")) print "skip"; ?>
! 6: --FILE--
! 7: <?php
! 8: $a = gmp_init("0x41682179fbf5");
! 9: printf("Decimal: %s, -36-based: %s\n", gmp_strval($a), gmp_strval($a,-36));
! 10: printf("Decimal: %s, 36-based: %s\n", gmp_strval($a), gmp_strval($a,36));
! 11: printf("Decimal: %s, -1-based: %s\n", gmp_strval($a), gmp_strval($a,-1));
! 12: printf("Decimal: %s, 1-based: %s\n", gmp_strval($a), gmp_strval($a,1));
! 13: printf("Decimal: %s, -37-based: %s\n", gmp_strval($a), gmp_strval($a,-37));
! 14: printf("Decimal: %s, 37-based: %s\n", gmp_strval($a), gmp_strval($a,37));
! 15: printf("Decimal: %s, 62-based: %s\n", gmp_strval($a), gmp_strval($a,62));
! 16: printf("Decimal: %s, 63-based: %s\n\n", gmp_strval($a), gmp_strval($a,63));
! 17: printf("Base 32 and 62-based: %s\n", gmp_strval(gmp_init("gh82179fbf5", 32), 62));
! 18: ?>
! 19: --EXPECTF--
! 20: Decimal: 71915494046709, -36-based: PHPISCOOL
! 21: Decimal: 71915494046709, 36-based: phpiscool
! 22:
! 23: Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line 5
! 24: Decimal: 71915494046709, -1-based:
! 25:
! 26: Warning: gmp_strval(): Bad base for conversion: 1 (should be between 2 and %d or -2 and -%d) in %s on line 6
! 27: Decimal: 71915494046709, 1-based:
! 28:
! 29: Warning: gmp_strval(): Bad base for conversion: -37 (should be between 2 and %d or -2 and -%d) in %s on line 7
! 30: Decimal: 71915494046709, -37-based:
! 31: Decimal: 71915494046709, 37-based: KHKATELJF
! 32: Decimal: 71915494046709, 62-based: KQ6yq741
! 33:
! 34: Warning: gmp_strval(): Bad base for conversion: 63 (should be between 2 and %d or -2 and -%d) in %s on line 10
! 35: Decimal: 71915494046709, 63-based:
! 36:
! 37: Base 32 and 62-based: 1NHkAcdIiD
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>