CVSROOT: /sources/m4 Module name: m4 Changes by: Eric Blake <ericb> 07/01/13 13:55:37
Index: tests/builtins.at =================================================================== RCS file: /sources/m4/m4/tests/builtins.at,v retrieving revision 1.35 retrieving revision 1.36 diff -u -b -r1.35 -r1.36 --- tests/builtins.at 16 Nov 2006 14:42:38 -0000 1.35 +++ tests/builtins.at 13 Jan 2007 13:55:37 -0000 1.36 @@ -1,5 +1,5 @@ # Hand crafted tests for GNU M4. -*- Autotest -*- -# Copyright (C) 2001, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -320,140 +320,6 @@ -## --- ## -## gmp ## -## --- ## - -AT_SETUP([gmp]) -AT_CHECK_DYNAMIC_MODULE - -# cannot perform test without --with-gmp -AT_CHECK([test "$USE_GMP" = yes || exit 77]) - -AT_DATA([[in]], -[[divert(-1) -# forloop(i, from, to, stmt) - -define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') -define(`_forloop', - `$4`'ifelse($1, `$3', , - `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') -divert -forloop(`x', 1, 100, `2**x = mpeval(2**x) -') -]]) - -AT_DATA([[expout]], -[[ -2**1 = 2 -2**2 = 4 -2**3 = 8 -2**4 = 16 -2**5 = 32 -2**6 = 64 -2**7 = 128 -2**8 = 256 -2**9 = 512 -2**10 = 1024 -2**11 = 2048 -2**12 = 4096 -2**13 = 8192 -2**14 = 16384 -2**15 = 32768 -2**16 = 65536 -2**17 = 131072 -2**18 = 262144 -2**19 = 524288 -2**20 = 1048576 -2**21 = 2097152 -2**22 = 4194304 -2**23 = 8388608 -2**24 = 16777216 -2**25 = 33554432 -2**26 = 67108864 -2**27 = 134217728 -2**28 = 268435456 -2**29 = 536870912 -2**30 = 1073741824 -2**31 = 2147483648 -2**32 = 4294967296 -2**33 = 8589934592 -2**34 = 17179869184 -2**35 = 34359738368 -2**36 = 68719476736 -2**37 = 137438953472 -2**38 = 274877906944 -2**39 = 549755813888 -2**40 = 1099511627776 -2**41 = 2199023255552 -2**42 = 4398046511104 -2**43 = 8796093022208 -2**44 = 17592186044416 -2**45 = 35184372088832 -2**46 = 70368744177664 -2**47 = 140737488355328 -2**48 = 281474976710656 -2**49 = 562949953421312 -2**50 = 1125899906842624 -2**51 = 2251799813685248 -2**52 = 4503599627370496 -2**53 = 9007199254740992 -2**54 = 18014398509481984 -2**55 = 36028797018963968 -2**56 = 72057594037927936 -2**57 = 144115188075855872 -2**58 = 288230376151711744 -2**59 = 576460752303423488 -2**60 = 1152921504606846976 -2**61 = 2305843009213693952 -2**62 = 4611686018427387904 -2**63 = 9223372036854775808 -2**64 = 18446744073709551616 -2**65 = 36893488147419103232 -2**66 = 73786976294838206464 -2**67 = 147573952589676412928 -2**68 = 295147905179352825856 -2**69 = 590295810358705651712 -2**70 = 1180591620717411303424 -2**71 = 2361183241434822606848 -2**72 = 4722366482869645213696 -2**73 = 9444732965739290427392 -2**74 = 18889465931478580854784 -2**75 = 37778931862957161709568 -2**76 = 75557863725914323419136 -2**77 = 151115727451828646838272 -2**78 = 302231454903657293676544 -2**79 = 604462909807314587353088 -2**80 = 1208925819614629174706176 -2**81 = 2417851639229258349412352 -2**82 = 4835703278458516698824704 -2**83 = 9671406556917033397649408 -2**84 = 19342813113834066795298816 -2**85 = 38685626227668133590597632 -2**86 = 77371252455336267181195264 -2**87 = 154742504910672534362390528 -2**88 = 309485009821345068724781056 -2**89 = 618970019642690137449562112 -2**90 = 1237940039285380274899124224 -2**91 = 2475880078570760549798248448 -2**92 = 4951760157141521099596496896 -2**93 = 9903520314283042199192993792 -2**94 = 19807040628566084398385987584 -2**95 = 39614081257132168796771975168 -2**96 = 79228162514264337593543950336 -2**97 = 158456325028528675187087900672 -2**98 = 316912650057057350374175801344 -2**99 = 633825300114114700748351602688 -2**100 = 1267650600228229401496703205376 - -]]) - -AT_CHECK_M4([-m mpeval in], 0, expout) - -AT_CLEANUP - - - ## ------- ## ## include ## ## ------- ## @@ -630,6 +496,138 @@ AT_CLEANUP +## ------ ## +## mpeval ## +## ------ ## + +AT_SETUP([mpeval]) +AT_CHECK_DYNAMIC_MODULE +AT_CHECK_GMP + +AT_DATA([[in]], +[[divert(-1) +# forloop(i, from, to, stmt) + +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') +define(`_forloop', + `$4`'ifelse($1, `$3', , + `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') +divert +forloop(`x', 1, 100, `2**x = mpeval(2**x) +') +]]) + +AT_DATA([[expout]], +[[ +2**1 = 2 +2**2 = 4 +2**3 = 8 +2**4 = 16 +2**5 = 32 +2**6 = 64 +2**7 = 128 +2**8 = 256 +2**9 = 512 +2**10 = 1024 +2**11 = 2048 +2**12 = 4096 +2**13 = 8192 +2**14 = 16384 +2**15 = 32768 +2**16 = 65536 +2**17 = 131072 +2**18 = 262144 +2**19 = 524288 +2**20 = 1048576 +2**21 = 2097152 +2**22 = 4194304 +2**23 = 8388608 +2**24 = 16777216 +2**25 = 33554432 +2**26 = 67108864 +2**27 = 134217728 +2**28 = 268435456 +2**29 = 536870912 +2**30 = 1073741824 +2**31 = 2147483648 +2**32 = 4294967296 +2**33 = 8589934592 +2**34 = 17179869184 +2**35 = 34359738368 +2**36 = 68719476736 +2**37 = 137438953472 +2**38 = 274877906944 +2**39 = 549755813888 +2**40 = 1099511627776 +2**41 = 2199023255552 +2**42 = 4398046511104 +2**43 = 8796093022208 +2**44 = 17592186044416 +2**45 = 35184372088832 +2**46 = 70368744177664 +2**47 = 140737488355328 +2**48 = 281474976710656 +2**49 = 562949953421312 +2**50 = 1125899906842624 +2**51 = 2251799813685248 +2**52 = 4503599627370496 +2**53 = 9007199254740992 +2**54 = 18014398509481984 +2**55 = 36028797018963968 +2**56 = 72057594037927936 +2**57 = 144115188075855872 +2**58 = 288230376151711744 +2**59 = 576460752303423488 +2**60 = 1152921504606846976 +2**61 = 2305843009213693952 +2**62 = 4611686018427387904 +2**63 = 9223372036854775808 +2**64 = 18446744073709551616 +2**65 = 36893488147419103232 +2**66 = 73786976294838206464 +2**67 = 147573952589676412928 +2**68 = 295147905179352825856 +2**69 = 590295810358705651712 +2**70 = 1180591620717411303424 +2**71 = 2361183241434822606848 +2**72 = 4722366482869645213696 +2**73 = 9444732965739290427392 +2**74 = 18889465931478580854784 +2**75 = 37778931862957161709568 +2**76 = 75557863725914323419136 +2**77 = 151115727451828646838272 +2**78 = 302231454903657293676544 +2**79 = 604462909807314587353088 +2**80 = 1208925819614629174706176 +2**81 = 2417851639229258349412352 +2**82 = 4835703278458516698824704 +2**83 = 9671406556917033397649408 +2**84 = 19342813113834066795298816 +2**85 = 38685626227668133590597632 +2**86 = 77371252455336267181195264 +2**87 = 154742504910672534362390528 +2**88 = 309485009821345068724781056 +2**89 = 618970019642690137449562112 +2**90 = 1237940039285380274899124224 +2**91 = 2475880078570760549798248448 +2**92 = 4951760157141521099596496896 +2**93 = 9903520314283042199192993792 +2**94 = 19807040628566084398385987584 +2**95 = 39614081257132168796771975168 +2**96 = 79228162514264337593543950336 +2**97 = 158456325028528675187087900672 +2**98 = 316912650057057350374175801344 +2**99 = 633825300114114700748351602688 +2**100 = 1267650600228229401496703205376 + +]]) + +AT_CHECK_M4([-m mpeval in], 0, expout) + +AT_CLEANUP + + + ## ----------- ## ## multiquotes ## ## ----------- ##