Skip to content

Commit ca6b471

Browse files
committed
add .sh and fix answers
1 parent 47064a7 commit ca6b471

10 files changed

+34
-2
lines changed

generate_answer.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
egison -t ${1} > test/answer/${1}

generate_answers.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
find ./sample | grep ".egi$" | xargs -t -I{} sh -c 'egison -t {} > test/answer/{}'

test/Test.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Main where
22

33
import Control.Applicative
44
import Control.Monad
5+
import Control.Monad.IO.Class
56
import Data.IORef
67
import Data.List
78

@@ -19,8 +20,10 @@ import Language.Egison
1920
import UnitTest
2021

2122
main = do
22-
unitTestCases <- glob "test/[^answer]**/*.egi"
23-
sampleTestCases <- glob "test/answer/**/*.egi"
23+
-- unitTestCases <- glob "test/[^answer]**/*.egi"
24+
unitTestCases <- return []
25+
-- sampleTestCases <- glob "test/answer/**/*.egi"
26+
sampleTestCases <- glob "test/answer/sample/math/geometry/*.egi"
2427
defaultMain $ hUnitTestToTests $ test $ map runUnitTestCase unitTestCases ++ map runSampleTestCase sampleTestCases
2528

2629
runSampleTestCase :: FilePath -> Test

test/answer/sample/io/args.egi

Whitespace-only changes.

test/answer/sample/io/cat.egi

Whitespace-only changes.

test/answer/sample/io/cut.egi

Whitespace-only changes.

test/answer/sample/io/hello.egi

Whitespace-only changes.

test/answer/sample/io/print-primes.egi

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[| [| (* r (cos θ) (cos φ)) (* r (cos θ) (sin φ)) (* -1 r (sin θ)) |] [| (* -1 r (sin θ) (sin φ)) (* r (sin θ) (cos φ)) 0 |] |]_i_j
2+
[| [| r^2 0 |] [| 0 (* r^2 (sin θ)^2) |] |]_#_#
3+
[| [| (/ 1 r^2) 0 |] [| 0 (/ 1 (* r^2 (sin θ)^2)) |] |]~#~#
4+
(tensor {2 2 2} {0 0 0 (* -1 r^2 (sin θ) (cos θ)) 0 (* r^2 (sin θ) (cos θ)) (* r^2 (sin θ) (cos θ)) 0} )_#_#_#
5+
[| [| 0 0 |] [| 0 (* -1 r^2 (sin θ) (cos θ)) |] |]_#_#
6+
[| [| 0 (* r^2 (sin θ) (cos θ)) |] [| (* r^2 (sin θ) (cos θ)) 0 |] |]_#_#
7+
(tensor {2 2 2} {0 0 0 (* -1 (sin θ) (cos θ)) 0 (/ (cos θ) (sin θ)) (/ (cos θ) (sin θ)) 0} )~#_#_#
8+
[| [| 0 0 |] [| 0 (* -1 (sin θ) (cos θ)) |] |]_#_#
9+
[| [| 0 (/ (cos θ) (sin θ)) |] [| (/ (cos θ) (sin θ)) 0 |] |]_#_#
10+
(tensor {2 2 2} {0 0 0 0 0 0 0 0} )_#_#_#
11+
(tensor {2 2 2 2} {0 0 0 0 0 (sin θ)^2 (* -1 (sin θ)^2) 0 0 -1 1 0 0 0 0 0} )~#_#_#_#
12+
[| [| 0 0 |] [| 0 0 |] |]~#_#
13+
[| [| 0 (sin θ)^2 |] [| -1 0 |] |]~#_#
14+
[| [| 0 (* -1 (sin θ)^2) |] [| 1 0 |] |]~#_#
15+
[| [| 0 0 |] [| 0 0 |] |]~#_#
16+
(tensor {2 2 2 2} {0 0 0 0 0 (* r^2 (sin θ)^2) (* -1 r^2 (sin θ)^2) 0 0 (* -1 r^2 (sin θ)^2) (* r^2 (sin θ)^2) 0 0 0 0 0} )_#_#_#_#
17+
[| [| 0 0 |] [| 0 0 |] |]_#_#
18+
[| [| 0 (* r^2 (sin θ)^2) |] [| (* -1 r^2 (sin θ)^2) 0 |] |]_#_#
19+
[| [| 0 (* -1 r^2 (sin θ)^2) |] [| (* r^2 (sin θ)^2) 0 |] |]_#_#
20+
[| [| 0 0 |] [| 0 0 |] |]_#_#
21+
[| [| 1 0 |] [| 0 (sin θ)^2 |] |]_#_#
22+
(/ 2 r^2)
23+
(tensor {2 2 2 2 2} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} )_#_#_#_#_#

test/answer/sample/tail-recursion.egi

Whitespace-only changes.

0 commit comments

Comments
 (0)