net.sf.farrago.fennel.calc
Class CalcProgramBuilderTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by net.sf.farrago.fennel.calc.CalcProgramBuilderTest
All Implemented Interfaces:
Test

public class CalcProgramBuilderTest
extends TestCase

Unit test for CalcProgramBuilder.

Since:
Jan 11, 2004
Version:
$Id: //open/dev/farrago/src/net/sf/farrago/fennel/calc/CalcProgramBuilderTest.java#1 $
Author:
jhyde

Field Summary
(package private)  CalcProgramBuilder builder
           
static String NL
           
static String T
           
 
Constructor Summary
CalcProgramBuilderTest(String name)
           
 
Method Summary
(package private)  void assertExceptionIsThrown(CalcProgramBuilder.InstructionDef instr, CalcProgramBuilder.Operand[] args, String expectedMsg)
           
(package private)  void assertExceptionIsThrown(Method method, Object[] args, String expectedMsg)
           
(package private)  void assertExceptionIsThrown(String expectedMsg)
           
(package private)  void assertExceptionIsThrown(String methodName, Object[] args, String expectedMsg)
           
(package private)  List<Method> getMethods(String pattern)
           
 void setUp()
           
 void testAddBoolInstructionFails()
           
 void testAddDivideByZeroFail()
           
 void testAddNativeInstructionsFail()
           
 void testCallSubstr()
           
 void testComments()
           
 void testEmpty()
          Tests that the empty program works.
 void testInconstentTypes()
           
 void testIntegralNativeInstructionsFail()
           
 void testJmpToNoWhere()
           
 void testJumpBooleanFails()
           
 void testJumpingBack()
          Tests if the builder asserts when trying to call jump to a previous line.
 void testJumpingToItSelf()
           
 void testLabelJump()
           
 void testLabelJumpFails()
           
 void testLabelJumpToItself()
           
 void testLabelMultipleTimes()
           
 void testPointerBoolInstructionsFail()
           
 void testRef()
           
 void testRefFails()
           
 void testReturnConstant()
           
 void testUseSameConstantTwice()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NL

public static final String NL

T

public static final String T

builder

CalcProgramBuilder builder
Constructor Detail

CalcProgramBuilderTest

public CalcProgramBuilderTest(String name)
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class TestCase
Throws:
Exception

testEmpty

public void testEmpty()
Tests that the empty program works.


testReturnConstant

public void testReturnConstant()

testComments

public void testComments()

testRef

public void testRef()

testRefFails

public void testRefFails()

testUseSameConstantTwice

public void testUseSameConstantTwice()

testInconstentTypes

public void testInconstentTypes()

testCallSubstr

public void testCallSubstr()

testJmpToNoWhere

public void testJmpToNoWhere()

testJumpingBack

public void testJumpingBack()
Tests if the builder asserts when trying to call jump to a previous line. If there is a need to have loops in the future. Remove the assert check in the builder


testJumpingToItSelf

public void testJumpingToItSelf()

testLabelJump

public void testLabelJump()

testLabelJumpFails

public void testLabelJumpFails()

testLabelJumpToItself

public void testLabelJumpToItself()

testLabelMultipleTimes

public void testLabelMultipleTimes()

testJumpBooleanFails

public void testJumpBooleanFails()
                          throws Exception
Throws:
Exception

testAddBoolInstructionFails

public void testAddBoolInstructionFails()
                                 throws Exception
Throws:
Exception

testAddDivideByZeroFail

public void testAddDivideByZeroFail()
                             throws Exception
Throws:
Exception

testAddNativeInstructionsFail

public void testAddNativeInstructionsFail()
                                   throws Exception
Throws:
Exception

testIntegralNativeInstructionsFail

public void testIntegralNativeInstructionsFail()
                                        throws Exception
Throws:
Exception

testPointerBoolInstructionsFail

public void testPointerBoolInstructionsFail()
                                     throws Exception
Throws:
Exception

getMethods

List<Method> getMethods(String pattern)

assertExceptionIsThrown

void assertExceptionIsThrown(Method method,
                             Object[] args,
                             String expectedMsg)
                       throws Exception
Throws:
Exception

assertExceptionIsThrown

void assertExceptionIsThrown(CalcProgramBuilder.InstructionDef instr,
                             CalcProgramBuilder.Operand[] args,
                             String expectedMsg)
                       throws Exception
Throws:
Exception

assertExceptionIsThrown

void assertExceptionIsThrown(String methodName,
                             Object[] args,
                             String expectedMsg)
                       throws Exception
Throws:
Exception

assertExceptionIsThrown

void assertExceptionIsThrown(String expectedMsg)