From: simonm Date: Wed, 7 Jan 1998 18:13:39 +0000 (+0000) Subject: [project @ 1998-01-07 18:12:40 by simonm] X-Git-Tag: Approx_2487_patches~1116 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=7f9b96f5ee1ef690c35dc98747796d69c52393ae;p=ghc-hetmet.git [project @ 1998-01-07 18:12:40 by simonm] Add numeric tests from nofib/GHC_ONLY. --- diff --git a/ghc/tests/Makefile b/ghc/tests/Makefile index 0601aa1..b626f2b 100644 --- a/ghc/tests/Makefile +++ b/ghc/tests/Makefile @@ -7,6 +7,7 @@ SUBDIRS = \ codeGen \ deSugar \ deriving \ + numeric \ printing \ reader \ rename \ diff --git a/ghc/tests/numeric/Makefile b/ghc/tests/numeric/Makefile new file mode 100644 index 0000000..7a4e87b --- /dev/null +++ b/ghc/tests/numeric/Makefile @@ -0,0 +1,11 @@ +#----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 1998/01/07 18:12:52 simonm Exp $ + +TOP = .. +include $(TOP)/mk/boilerplate.mk + +SUBDIRS = should_run + +include $(TOP)/mk/target.mk + + diff --git a/ghc/tests/numeric/arith003.hs b/ghc/tests/numeric/arith003.hs deleted file mode 100644 index 24dd4fc..0000000 --- a/ghc/tests/numeric/arith003.hs +++ /dev/null @@ -1,2 +0,0 @@ -[-2147483647, 2147483647, -4, 12, -2147483643, -2147483647, 2, 2, 2, 8, 8, 52861, 24, 24, 24, 0, 0, 207585147, 1, 4096, 4096] -[-2147483647, 2147483647, -4, 12, -2147483643, -2147483647, 2, 2, 2, 8, 8, 52861, 24, 24, 24, 0, 0, 207585147, 1, 4096, 4096] diff --git a/ghc/tests/numeric/array001.hs b/ghc/tests/numeric/array001.hs deleted file mode 100644 index 005ba17..0000000 --- a/ghc/tests/numeric/array001.hs +++ /dev/null @@ -1 +0,0 @@ -array (1, 100) [(1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720), (7, 5040), (8, 40320), (9, 362880), (10, 3628800), (11, 39916800), (12, 479001600), (13, 6227020800), (14, 87178291200), (15, 1307674368000), (16, 20922789888000), (17, 355687428096000), (18, 6402373705728000), (19, 121645100408832000), (20, 2432902008176640000), (21, 51090942171709440000), (22, 1124000727777607680000), (23, 25852016738884976640000), (24, 620448401733239439360000), (25, 15511210043330985984000000), (26, 403291461126605635584000000), (27, 10888869450418352160768000000), (28, 304888344611713860501504000000), (29, 8841761993739701954543616000000), (30, 265252859812191058636308480000000), (31, 8222838654177922817725562880000000), (32, 263130836933693530167218012160000000), (33, 8683317618811886495518194401280000000), (34, 295232799039604140847618609643520000000), (35, 10333147966386144929666651337523200000000), (36, 371993326789901217467999448150835200000000), (37, 13763753091226345046315979581580902400000000), (38, 523022617466601111760007224100074291200000000), (39, 20397882081197443358640281739902897356800000000), (40, 815915283247897734345611269596115894272000000000), (41, 33452526613163807108170062053440751665152000000000), (42, 1405006117752879898543142606244511569936384000000000), (43, 60415263063373835637355132068513997507264512000000000), (44, 2658271574788448768043625811014615890319638528000000000), (45, 119622220865480194561963161495657715064383733760000000000), (46, 5502622159812088949850305428800254892961651752960000000000), (47, 258623241511168180642964355153611979969197632389120000000000), (48, 12413915592536072670862289047373375038521486354677760000000000), (49, 608281864034267560872252163321295376887552831379210240000000000), (50, 30414093201713378043612608166064768844377641568960512000000000000), (51, 1551118753287382280224243016469303211063259720016986112000000000000), (52, 80658175170943878571660636856403766975289505440883277824000000000000), (53, 4274883284060025564298013753389399649690343788366813724672000000000000), (54, 230843697339241380472092742683027581083278564571807941132288000000000000), (55, 12696403353658275925965100847566516959580321051449436762275840000000000000), (56, 710998587804863451854045647463724949736497978881168458687447040000000000000), (57, 40526919504877216755680601905432322134980384796226602145184481280000000000000), (58, 2350561331282878571829474910515074683828862318181142924420699914240000000000000), (59, 138683118545689835737939019720389406345902876772687432540821294940160000000000000), (60, 8320987112741390144276341183223364380754172606361245952449277696409600000000000000), (61, 507580213877224798800856812176625227226004528988036003099405939480985600000000000000), (62, 31469973260387937525653122354950764088012280797258232192163168247821107200000000000000), (63, 1982608315404440064116146708361898137544773690227268628106279599612729753600000000000000), (64, 126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000), (65, 8247650592082470666723170306785496252186258551345437492922123134388955774976000000000000000), (66, 544344939077443064003729240247842752644293064388798874532860126869671081148416000000000000000), (67, 36471110918188685288249859096605464427167635314049524593701628500267962436943872000000000000000), (68, 2480035542436830599600990418569171581047399201355367672371710738018221445712183296000000000000000), (69, 171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000), (70, 11978571669969891796072783721689098736458938142546425857555362864628009582789845319680000000000000000), (71, 850478588567862317521167644239926010288584608120796235886430763388588680378079017697280000000000000000), (72, 61234458376886086861524070385274672740778091784697328983823014963978384987221689274204160000000000000000), (73, 4470115461512684340891257138125051110076800700282905015819080092370422104067183317016903680000000000000000), (74, 330788544151938641225953028221253782145683251820934971170611926835411235700971565459250872320000000000000000), (75, 24809140811395398091946477116594033660926243886570122837795894512655842677572867409443815424000000000000000000), (76, 1885494701666050254987932260861146558230394535379329335672487982961844043495537923117729972224000000000000000000), (77, 145183092028285869634070784086308284983740379224208358846781574688061991349156420080065207861248000000000000000000), (78, 11324281178206297831457521158732046228731749579488251990048962825668835325234200766245086213177344000000000000000000), (79, 894618213078297528685144171539831652069808216779571907213868063227837990693501860533361810841010176000000000000000000), (80, 71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000), (81, 5797126020747367985879734231578109105412357244731625958745865049716390179693892056256184534249745940480000000000000000000), (82, 475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000), (83, 39455239697206586511897471180120610571436503407643446275224357528369751562996629334879591940103770870906880000000000000000000), (84, 3314240134565353266999387579130131288000666286242049487118846032383059131291716864129885722968716753156177920000000000000000000), (85, 281710411438055027694947944226061159480056634330574206405101912752560026159795933451040286452340924018275123200000000000000000000), (86, 24227095383672732381765523203441259715284870552429381750838764496720162249742450276789464634901319465571660595200000000000000000000), (87, 2107757298379527717213600518699389595229783738061356212322972511214654115727593174080683423236414793504734471782400000000000000000000), (88, 185482642257398439114796845645546284380220968949399346684421580986889562184028199319100141244804501828416633516851200000000000000000000), (89, 16507955160908461081216919262453619309839666236496541854913520707833171034378509739399912570787600662729080382999756800000000000000000000), (90, 1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000), (91, 135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000), (92, 12438414054641307255475324325873553077577991715875414356840239582938137710983519518443046123837041347353107486982656753664000000000000000000000), (93, 1156772507081641574759205162306240436214753229576413535186142281213246807121467315215203289516844845303838996289387078090752000000000000000000000), (94, 108736615665674308027365285256786601004186803580182872307497374434045199869417927630229109214583415458560865651202385340530688000000000000000000000), (95, 10329978488239059262599702099394727095397746340117372869212250571234293987594703124871765375385424468563282236864226607350415360000000000000000000000), (96, 991677934870949689209571401541893801158183648651267795444376054838492222809091499987689476037000748982075094738965754305639874560000000000000000000000), (97, 96192759682482119853328425949563698712343813919172976158104477319333745612481875498805879175589072651261284189679678167647067832320000000000000000000000), (98, 9426890448883247745626185743057242473809693764078951663494238777294707070023223798882976159207729119823605850588608460429412647567360000000000000000000000), (99, 933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000), (100, 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000)] diff --git a/ghc/tests/numeric/array002.hs b/ghc/tests/numeric/array002.hs deleted file mode 100644 index cc8c836..0000000 --- a/ghc/tests/numeric/array002.hs +++ /dev/null @@ -1 +0,0 @@ -array (102, 113) [(102, 6.3661977236758138e-1), (103, 1.9098593171027440), (104, 7.6394372684109761), (105, 38.197186342054884), (106, 229.18311805232929), (107, 1604.2818263663050), (108, 12834.254610930440), (109, 115508.29149837396), (110, 1155082.9149837396), (111, 12705912.064821135), (112, 152470944.77785364), (113, 1982122282.1120973)] diff --git a/ghc/tests/numeric/should_run/Makefile b/ghc/tests/numeric/should_run/Makefile new file mode 100644 index 0000000..3163b43 --- /dev/null +++ b/ghc/tests/numeric/should_run/Makefile @@ -0,0 +1,10 @@ +#----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 1998/01/07 18:13:11 simonm Exp $ + +TOP = ../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/should_run.mk + +HC_OPTS += -dcore-lint + +include $(TOP)/mk/target.mk diff --git a/ghc/tests/numeric/should_run/arith001.hs b/ghc/tests/numeric/should_run/arith001.hs new file mode 100644 index 0000000..1ab0c90 --- /dev/null +++ b/ghc/tests/numeric/should_run/arith001.hs @@ -0,0 +1,28 @@ +--!!! conversions: Double <=> Rational/Integer things +-- +import Ratio + +main = putStr (show r42 ++ "\n" ++ + show nu42 ++ ", " ++ + show de42 ++ "\n" ++ + show nu42d ++ ", " ++ + show de42d ++ "\n" ++ + show s2 ++ ", " ++ + show e2 ++ "\n" ++ + show s ++ ", " ++ + show e ++ "\n" ) + where + d42 :: Double + r42 :: Rational + nu42, de42 :: Integer + nu42d, de42d :: Double + + d42 = 42 + r42 = toRational d42 + nu42 = numerator r42 + de42 = denominator r42 + nu42d= fromInteger nu42 + de42d= fromInteger de42 + + (s,e)= decodeFloat (nu42d / de42d ) + (s2,e2) = decodeFloat d42 diff --git a/ghc/tests/numeric/arith001.hs b/ghc/tests/numeric/should_run/arith001.stdout similarity index 100% rename from ghc/tests/numeric/arith001.hs rename to ghc/tests/numeric/should_run/arith001.stdout diff --git a/ghc/tests/numeric/should_run/arith002.hs b/ghc/tests/numeric/should_run/arith002.hs new file mode 100644 index 0000000..fbeb7bf --- /dev/null +++ b/ghc/tests/numeric/should_run/arith002.hs @@ -0,0 +1,52 @@ +--!!! basic Rational operations +-- +import Ratio + +main + = putStr + (-- Ratio Ints + show [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc] + ++ "\n" + -- the Ints + ++ show ((map numerator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc]) + ++(map denominator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc])) + ++ "\n" + -- Booleans +-- ++ show [] +-- ++ "\n" + + -- Rationals (Ratio Integers) + ++ show [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc] + ++ "\n" + -- the Integers + ++ show ((map numerator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc]) + ++(map denominator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc])) + ++ "\n" + -- Booleans +-- ++ show [] +-- ++ "\n" + ) + where + i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc :: Ratio Int + + i0a = 0 % 1 + i0b = -0 % 1 + i0c = 0 % -1 + i2a = 4 % 2 + i2b = -4 % -2 + im2a = -4 % 2 + im2b = 4 % -2 + i_pi = 22 % 7 + i_misc = 2 % 10000 + + r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc :: Rational + + r0a = 0 % 1 + r0b = -0 % 1 + r0c = 0 % -1 + r2a = 4 % 2 + r2b = -4 % -2 + rm2a = -4 % 2 + rm2b = 4 % -2 + r_pi = 22 % 7 + r_misc = 2 % 10000 diff --git a/ghc/tests/numeric/arith002.hs b/ghc/tests/numeric/should_run/arith002.stdout similarity index 100% rename from ghc/tests/numeric/arith002.hs rename to ghc/tests/numeric/should_run/arith002.stdout diff --git a/ghc/tests/numeric/should_run/arith003.hs b/ghc/tests/numeric/should_run/arith003.hs new file mode 100644 index 0000000..2f11800 --- /dev/null +++ b/ghc/tests/numeric/should_run/arith003.hs @@ -0,0 +1,87 @@ +--!!! test arithmetic operations from "Prelude" (gcd, ldm, etc.) +-- +main + = let + minInt = minBound :: Int + maxInt = maxBound :: Int + in + putStr + (-- w/ Ints + show [ + minInt, maxInt, + + subtract i8 i4, + subtract i8m i4, + subtract maxInt i4, + subtract i0 minInt, + + gcd i8 i6, + gcd i8m i6, + gcd i8m i6m, + gcd i8m i0, + gcd i0 i8m, + gcd (4070297::Int) (2695911::Int), -- 52,861 + + lcm i8 i6, + lcm i8m i6, + lcm i8m i6m, + lcm i8m i0, + lcm i0 i8m, + lcm (4070297::Int) (2695911::Int), -- 207,585,147 + + i8 ^ i0, + i8m ^ i4, + i4 ^ i6 + -- ToDo: more stuff + + ] + ++ "\n" + + -- w/ Integers + ++ show [ + toInteger minInt, toInteger maxInt, + + subtract i8I i4I, + subtract i8mI i4I, + subtract (toInteger maxInt) i4I, + subtract i0I (toInteger minInt), + + gcd i8I i6I, + gcd i8mI i6I, + gcd i8mI i6mI, + gcd i8mI i0I, + gcd i0I i8mI, + gcd (4070297::Integer) (2695911::Integer), -- 52,861 + + lcm i8I i6I, + lcm i8mI i6I, + lcm i8mI i6mI, + lcm i8mI i0I, + lcm i0I i8mI, + lcm (4070297::Integer) (2695911::Integer), -- 207,585,147 + + i8I ^ i0I, + i8mI ^ i4I, + i4I ^ i6I + -- ToDo: more stuff + ] + ++ "\n" + ) + where + i0, i4, i4m, i6, i6m, i8, i8m :: Int + i0 = 0 + i4 = 4 + i4m = -4 + i6 = 6 + i6m = -6 + i8 = 8 + i8m = -8 + + i0I, i4I, i4mI, i6I, i6mI, i8I, i8mI :: Integer + i0I = 0 + i4I = 4 + i4mI = -4 + i6I = 6 + i6mI = -6 + i8I = 8 + i8mI = -8 diff --git a/ghc/tests/numeric/should_run/arith003.stdout b/ghc/tests/numeric/should_run/arith003.stdout new file mode 100644 index 0000000..01e1a5a --- /dev/null +++ b/ghc/tests/numeric/should_run/arith003.stdout @@ -0,0 +1,2 @@ +[-2147483648, 2147483647, -4, 12, -2147483643, -2147483648, 2, 2, 2, 8, 8, 52861, 24, 24, 24, 0, 0, 207585147, 1, 4096, 4096] +[-2147483648, 2147483647, -4, 12, -2147483643, -2147483648, 2, 2, 2, 8, 8, 52861, 24, 24, 24, 0, 0, 207585147, 1, 4096, 4096] diff --git a/ghc/tests/numeric/should_run/arith004.hs b/ghc/tests/numeric/should_run/arith004.hs new file mode 100644 index 0000000..30b37d3 --- /dev/null +++ b/ghc/tests/numeric/should_run/arith004.hs @@ -0,0 +1,86 @@ +--!!! test quot/rem/div/mod functions on Ints and Integers +-- +main + = putStr + (-- w/ Ints and Integers + show (unzipWith div ints_list) + ++ "\n" + ++ show (unzipWith div integers_list) + ++ "\n" + ++ show (unzipWith rem ints_list) + ++ "\n" + ++ show (unzipWith rem integers_list) + ++ "\n" + ++ show (unzipWith quot ints_list) + ++ "\n" + ++ show (unzipWith quot integers_list) + ++ "\n" + ++ show (unzipWith mod ints_list) + ++ "\n" + ++ show (unzipWith mod integers_list) + ++ "\n" + ++ show (unzipWith law1 ints_list) + ++ "\n" + ++ show (unzipWith law1 integers_list) + ++ "\n" + ++ show (unzipWith law2 ints_list) + ++ "\n" + ++ show (unzipWith law2 integers_list) + ++ "\n" + ) + where + ints_list :: [(Int, Int)] + integers_list :: [(Integer, Integer)] + + ints_list = [ + (0, 4), + (0, -8), + (7, 3), + (13, 4), + (13, -4), + (-13, 4), + (-13, -4), + (12345678, 10000), + (12345678, -10000), + (-12345678, 10000), + (-12345678, -10000), + (123456,10000), + (1234567,20000), + (12345678,-10000), + (123456789,10000), + (1234567890,-10000), + (-12345,10000), + (-123456789,-10000) + ] + + integers_list = [ + (0, 4), + (0, -8), + (7, 3), + (13, 4), + (13, -4), + (-13, 4), + (-13, -4), + (12345678, 10000), + (12345678, -10000), + (-12345678, 10000), + (-12345678, -10000), + (123456,10000), + (1234567,20000), + (12345678,-10000), + (123456789,10000), + (1234567890,-10000), + (-12345,10000), + (-123456789,-10000), + (12345678900,500000000), + (1234000000000000000000005678900,5001111111111111000000) + ] + +unzipWith :: (a -> b -> c) -> [(a,b)] -> [c] +unzipWith f [] = [] +unzipWith f ((x,y):zs) = f x y : unzipWith f zs + +law1, law2 :: Integral a => a -> a -> Bool + +law1 x y = (x `quot` y)*y + (x `rem` y) == x +law2 x y = (x `div` y)*y + (x `mod` y) == x diff --git a/ghc/tests/numeric/arith004.hs b/ghc/tests/numeric/should_run/arith004.stdout similarity index 100% rename from ghc/tests/numeric/arith004.hs rename to ghc/tests/numeric/should_run/arith004.stdout diff --git a/ghc/tests/numeric/should_run/arith005.hs b/ghc/tests/numeric/should_run/arith005.hs new file mode 100644 index 0000000..c472bdd --- /dev/null +++ b/ghc/tests/numeric/should_run/arith005.hs @@ -0,0 +1,60 @@ +--!!! test RealFrac ops (ceiling/floor/etc.) on Floats/Doubles +-- +main + = putStr + (-- {Float,Double} inputs, {Int,Integer} outputs + show ((map ceiling float_list) :: [Int]) + ++ "\n" + ++ show ((map ceiling float_list) :: [Integer]) + ++ "\n" + ++ show ((map ceiling double_list) :: [Int]) + ++ "\n" + ++ show ((map ceiling double_list) :: [Integer]) + ++ "\n" + ++ show ((map floor float_list) :: [Int]) + ++ "\n" + ++ show ((map floor float_list) :: [Integer]) + ++ "\n" + ++ show ((map floor double_list) :: [Int]) + ++ "\n" + ++ show ((map floor double_list) :: [Integer]) + ++ "\n" + ++ show ((map truncate float_list) :: [Int]) + ++ "\n" + ++ show ((map truncate float_list) :: [Integer]) + ++ "\n" + ++ show ((map truncate double_list) :: [Int]) + ++ "\n" + ++ show ((map truncate double_list) :: [Integer]) + ++ "\n" + ++ show ((map round float_list) :: [Int]) + ++ "\n" + ++ show ((map round float_list) :: [Integer]) + ++ "\n" + ++ show ((map round double_list) :: [Int]) + ++ "\n" + ++ show ((map round double_list) :: [Integer]) + ++ "\n" + ++ show ((map properFraction float_list) :: [(Int,Float)]) + ++ "\n" + ++ show ((map properFraction float_list) :: [(Integer,Float)]) + ++ "\n" + ++ show ((map properFraction double_list) :: [(Int,Double)]) + ++ "\n" + ++ show ((map properFraction double_list) :: [(Integer,Double)]) + ++ "\n" + ) + where + float_list :: [Float] + float_list = [ + 0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, + -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, + 102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi + ] + + double_list :: [Double] + double_list = [ + 0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, + -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, + 102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi + ] diff --git a/ghc/tests/numeric/arith005.hs b/ghc/tests/numeric/should_run/arith005.stdout similarity index 100% rename from ghc/tests/numeric/arith005.hs rename to ghc/tests/numeric/should_run/arith005.stdout diff --git a/ghc/tests/numeric/should_run/arith006.hs b/ghc/tests/numeric/should_run/arith006.hs new file mode 100644 index 0000000..3fb1acd --- /dev/null +++ b/ghc/tests/numeric/should_run/arith006.hs @@ -0,0 +1,3 @@ +--!!! printing Floats; was a bug in hbc (reported by andy) +-- +main = print ((fromInt 42) :: Float) diff --git a/ghc/tests/numeric/arith006.hs b/ghc/tests/numeric/should_run/arith006.stdout similarity index 100% rename from ghc/tests/numeric/arith006.hs rename to ghc/tests/numeric/should_run/arith006.stdout diff --git a/ghc/tests/numeric/should_run/arith007.hs b/ghc/tests/numeric/should_run/arith007.hs new file mode 100644 index 0000000..dc99edf --- /dev/null +++ b/ghc/tests/numeric/should_run/arith007.hs @@ -0,0 +1,19 @@ +--!!! test simple Integer things +-- +main + = putStr (shows integer_list "\n") + where + int_list :: [Int] + integer_list :: [Integer] + + int_list = (map fromInteger integer_list) + + integer_list = (map (* 2) + [1,3,5,7,9, + 11111111111111111111111111111, + 2222222222222222222222222222222222222, + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333, + -11111111111111111111111111111, + -2222222222222222222222222222222222222, + -3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + ]) diff --git a/ghc/tests/numeric/arith007.hs b/ghc/tests/numeric/should_run/arith007.stdout similarity index 100% rename from ghc/tests/numeric/arith007.hs rename to ghc/tests/numeric/should_run/arith007.stdout diff --git a/ghc/tests/numeric/should_run/arith008.hs b/ghc/tests/numeric/should_run/arith008.hs new file mode 100644 index 0000000..73bbd71 --- /dev/null +++ b/ghc/tests/numeric/should_run/arith008.hs @@ -0,0 +1,20 @@ +--!!! a random test from Nick North +-- (got this in mid-1993; don't remember why. WDP 95/02) +-- +random_numbers :: (Int, Int, Int) -> [Float] +random_numbers (s1,s2,s3) + = map (snd . properFraction . combine) (iterate f (s1,s2,s3)) + where + combine :: (Int,Int,Int) -> Float + combine (a,b,c) = + fromIntegral(a)/30269 + fromIntegral(b)/30307 + + fromIntegral(c)/30323 + f (a,b,c) = + ((171*a) `mod` 30269, (172*b) `mod` 30307, (170*c) `mod` 30323) + +-- partain: changed to cvt spaces into newlines (easier to see bugs) + +main = putStr (map cvt (shows (take 1000 (random_numbers (9807, 65, 32975))) "\n")) + where + cvt ' ' = '\n' + cvt c = c diff --git a/ghc/tests/numeric/arith008.hs b/ghc/tests/numeric/should_run/arith008.stdout similarity index 100% rename from ghc/tests/numeric/arith008.hs rename to ghc/tests/numeric/should_run/arith008.stdout diff --git a/ghc/tests/numeric/should_run/arith009.hs b/ghc/tests/numeric/should_run/arith009.hs new file mode 100644 index 0000000..43fe1b2 --- /dev/null +++ b/ghc/tests/numeric/should_run/arith009.hs @@ -0,0 +1,6 @@ +-- a prefix minus precedence test + +f :: Int -> Int -> Int -> Int +f x y z = - x * y ^ z + +main = putStr (shows (f 5 2 3) "\n") diff --git a/ghc/tests/numeric/arith009.hs b/ghc/tests/numeric/should_run/arith009.stdout similarity index 100% rename from ghc/tests/numeric/arith009.hs rename to ghc/tests/numeric/should_run/arith009.stdout diff --git a/ghc/tests/numeric/arith010.hs b/ghc/tests/numeric/should_run/arith010.hs similarity index 100% rename from ghc/tests/numeric/arith010.hs rename to ghc/tests/numeric/should_run/arith010.hs diff --git a/ghc/tests/numeric/should_run/arith010.stdout b/ghc/tests/numeric/should_run/arith010.stdout new file mode 100644 index 0000000..0dad8af --- /dev/null +++ b/ghc/tests/numeric/should_run/arith010.stdout @@ -0,0 +1,8 @@ +[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +[] +[1, 3, 5, 7, 9] +[10, 8, 6, 4, 2] +"abcdef" +"" +"acegikm" +"mlkjihgfedcba"