Ticket #7014: 7014-tests.patch

File 7014-tests.patch, 4.1 KB (added by pcapriotti, 3 years ago)
  • tests/numeric/should_run/Makefile

    From 4b539a7563e2e778e7415da4776d4d82d7d7bdde Mon Sep 17 00:00:00 2001
    From: Paolo Capriotti <[email protected]>
    Date: Fri, 6 Jul 2012 16:57:43 +0100
    Subject: [PATCH] Add test case for #7014.
    
    ---
     tests/numeric/should_run/Makefile      |    7 +++
     tests/numeric/should_run/T7014.hs      |   91 ++++++++++++++++++++++++++++++++
     tests/numeric/should_run/T7014.primops |   12 +++++
     tests/numeric/should_run/T7014.stdout  |   21 ++++++++
     tests/numeric/should_run/all.T         |    4 ++
     5 files changed, 135 insertions(+)
     create mode 100644 tests/numeric/should_run/T7014.hs
     create mode 100644 tests/numeric/should_run/T7014.primops
     create mode 100644 tests/numeric/should_run/T7014.stdout
    
    diff --git a/tests/numeric/should_run/Makefile b/tests/numeric/should_run/Makefile
    index 9101fbd..26ec990 100644
    a b  
    11TOP=../../..
    22include $(TOP)/mk/boilerplate.mk
    33include $(TOP)/mk/test.mk
     4
     5.PHONY: T7014
     6T7014:
     7        rm -f T7014.simpl T7014.o T7014.hi
     8        '$(TEST_HC)' -Wall -v0 -O --make T7014.hs -fforce-recomp -ddump-simpl > T7014.simpl
     9        ! grep -q -f T7014.primops T7014.simpl
     10        ./T7014
  • new file tests/numeric/should_run/T7014.hs

    diff --git a/tests/numeric/should_run/T7014.hs b/tests/numeric/should_run/T7014.hs
    new file mode 100644
    index 0000000..8237538
    - +  
     1module Main where
     2
     3import Data.Bits
     4import Data.Word
     5
     6test_and1 :: Word -> Word
     7test_and1 x = x .&. 0
     8
     9test_and2 :: Word -> Word
     10test_and2 x = 0 .&. x
     11
     12test_or1 :: Word -> Word
     13test_or1 x = x .|. 0
     14
     15test_or2 :: Word -> Word
     16test_or2 x = 0 .|. x
     17
     18test_shiftL :: Word -> Word
     19test_shiftL x = shiftL x 0
     20
     21test_shiftR :: Word -> Word
     22test_shiftR x = shiftR x 0
     23
     24test_add1 :: Int -> Int
     25test_add1 x = x + 0
     26
     27test_add2 :: Int -> Int
     28test_add2 x = 0 + x
     29
     30test_sub1 :: Int -> Int
     31test_sub1 x = x - 0
     32
     33test_sub2 :: Int -> Int
     34test_sub2 x = x - x
     35
     36test_mul1 :: Int -> Int
     37test_mul1 x = x * 1
     38
     39test_mul2 :: Int -> Int
     40test_mul2 x = 1 * x
     41
     42test_mul3 :: Int -> Int
     43test_mul3 x = x * 0
     44
     45test_quot :: Int -> Int
     46test_quot x = x `quot` 1
     47
     48test_rem :: Int -> Int
     49test_rem x = x `rem` 1
     50
     51test_addf1 :: Float -> Float
     52test_addf1 x = x + 0
     53
     54test_addf2 :: Float -> Float
     55test_addf2 x = 0 + x
     56
     57test_subf :: Float -> Float
     58test_subf x = x - 0
     59
     60test_mulf1 :: Float -> Float
     61test_mulf1 x = x * 1
     62
     63test_mulf2 :: Float -> Float
     64test_mulf2 x = 1 * x
     65
     66test_divf :: Float -> Float
     67test_divf x = x / 1
     68
     69main :: IO ()
     70main = do
     71  print $ test_and1 42
     72  print $ test_and2 43
     73  print $ test_or1 44
     74  print $ test_or2 45
     75  print $ test_shiftL 46
     76  print $ test_shiftR 47
     77  print $ test_add1 48
     78  print $ test_add2 49
     79  print $ test_sub1 50
     80  print $ test_sub2 51
     81  print $ test_mul1 52
     82  print $ test_mul2 53
     83  print $ test_mul3 54
     84  print $ test_quot 55
     85  print $ test_rem 56
     86  print $ test_addf1 57
     87  print $ test_addf2 58
     88  print $ test_subf 59
     89  print $ test_mulf1 60
     90  print $ test_mulf2 61
     91  print $ test_divf 62
  • new file tests/numeric/should_run/T7014.primops

    diff --git a/tests/numeric/should_run/T7014.primops b/tests/numeric/should_run/T7014.primops
    new file mode 100644
    index 0000000..3243666
    - +  
     1and#
     2or#
     3uncheckedShift.*#
     4\+#
     5\-#
     6\*#
     7quotInt#
     8remInt#
     9plusFloat#
     10minusFloat#
     11timesFloat#
     12divideFloat#
  • new file tests/numeric/should_run/T7014.stdout

    diff --git a/tests/numeric/should_run/T7014.stdout b/tests/numeric/should_run/T7014.stdout
    new file mode 100644
    index 0000000..749a8f6
    - +  
     10
     20
     344
     445
     546
     647
     748
     849
     950
     100
     1152
     1253
     130
     1455
     150
     1657.0
     1758.0
     1859.0
     1960.0
     2061.0
     2162.0
  • tests/numeric/should_run/all.T

    diff --git a/tests/numeric/should_run/all.T b/tests/numeric/should_run/all.T
    index 3e12a88..9244ac7 100644
    a b test('mul2', normal, compile_and_run, ['-fobject-code']) 
    5959test('quotRem2', normal, compile_and_run, ['-fobject-code'])
    6060test('T5863', normal, compile_and_run, [''])
    6161
     62test('T7014',
     63     extra_clean(['T7014.simpl']),
     64     run_command,
     65     ['$MAKE -s --no-print-directory T7014'])