Skip to content

Commit

Permalink
add test case for LispCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
gyc567 committed Jul 12, 2016
1 parent e73faf9 commit d4a8ea0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/test/java/com/github/eric/LispComplierTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LispComplierTest extends Specification {

}

def "Eval"() {
def "Eval 1,(+ 1 2 )"() {
given:"valuepair1 instance with 1,2,valuepair2 with + ,valuepair1"
ValuePair vp1=new ValuePair(1,2)
ValuePair vp2=new ValuePair("+",vp1)
Expand All @@ -29,4 +29,17 @@ class LispComplierTest extends Specification {
rt_int==3

}

def "Eval 2,(+ 1 2 3)"() {
given:"valuepari3 with 3,null valuepair1 instance with 1,2,valuepair2 with + ,valuepair1,valuepari3"
ValuePair vp3=new ValuePair(2,3)
ValuePair vp1=new ValuePair(1,vp3)
ValuePair vp2=new ValuePair("+",vp1)
when:"call the mathod eval with valuepair2"
Object rt=LispComplier.eval(vp2)
int rt_int=Integer.valueOf(rt)
then:"the result shall be 3"
rt_int==6

}
}

0 comments on commit d4a8ea0

Please sign in to comment.