{-# OPTIONS -fglasgow-exts #-}

module Test.Euler where

import MPS
import Prelude hiding ((.), (>))

import Test.Euler.Euler40
import Test.Euler.Euler80
import Test.Euler.Euler120

tests40 = 
  [
    show q1
  , show q2
  , show q3
  , show q4
  , show q5
  , show q6
  , show q7
  , show q8
  , show q9
  , show q10
  , show q11
  , show q12
  , show q13
  , "" -- show q14
  , show q15
  , show q16
  , show q17
  , show q18
  , show q19
  , show q20
  , show q21
  , show q22
  , show q23
  , show q24
  , show q25
  , show q26
  , show q27
  , show q28
  , show q29
  , show q30
  , show q31
  , show q32
  , show q33
  , show q34
  , show q35
  , show q36
  , show q37
  , show q38
  , show q39
  , show q40
  ]

tests80 =
  [
    show q41
  , show q42
  , show q43
  , show q44
  , show q45
  , show q46
  , show q47
  , show q48
  , show q49
  , show q50
  , show q51
  , show q52
  , show q53
  , show q54
  , show q55
  , show q56
  , show q57
  , show q58
  , show q59
  , show q60
  , show q61
  , show q62
  , show q63
  , show q64
  , show q65
  , show q66
  , show q67
  , show q68
  , show q69
  , show q70
  , show q71
  , show q72
  , show q73
  , show q74
  , show q75
  , show q76
  , show q77
  , show q78
  , show q79
  , show q80
  ]
  

tests120 =
  [
    show q81
  , show q82
  , show q83
  , show q84
  , show q85
  , show q86
  , show q87
  , show q88
--  , show q89
  , "fix me"
  , show q90
  , show q91
  , show q92
  , show q93
  , show q94
  , show q95
  , show q96
  , show q97
  , show q98
  , show q99
  ]
  
  
tests = tests40 ++ tests80 ++ tests120

euler = 
  tests
    .zip [1..]
    .map (\(x, y) -> 
      [ x.show.ljust digits ' '
      , " / "
      , total.show
      ] .join'.ljust 10 ' ' ++ " : " ++ no_string_quotes y
      )
    .mapM_ putStrLn
  
  where
    total = tests.length
    digits = total.explode.length
    no_string_quotes = 
        dropWhile (is '"')
      > reverse
      > dropWhile (is '"')
      > reverse
