KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > ast > visitor > rewriter > utils > TestBooleanStateStack


1 package org.jruby.ast.visitor.rewriter.utils;
2
3 import junit.framework.TestCase;
4
5 import org.jruby.ast.visitor.rewriter.utils.BooleanStateStack;
6
7 public class TestBooleanStateStack extends TestCase {
8
9     protected void setUp() throws Exception JavaDoc {
10         super.setUp();
11     }
12
13     protected void tearDown() throws Exception JavaDoc {
14         super.tearDown();
15     }
16
17     public void testBooleanStateStack() {
18         BooleanStateStack s = new BooleanStateStack(true, true);
19         assertTrue(s.isTrue());
20         s.revert();
21         assertTrue(s.isTrue());
22         
23         s = new BooleanStateStack(false, false);
24         assertFalse(s.isTrue());
25         s.revert();
26         assertFalse(s.isTrue());
27     }
28
29     public void testSet() {
30         BooleanStateStack s = new BooleanStateStack(true, true);
31         assertTrue(s.isTrue());
32         s.set(false);
33         assertFalse(s.isTrue());
34         s.revert();
35         assertTrue(s.isTrue());
36     }
37 }
38
Popular Tags