com.google.caja.ancillary.opt
Class StatementSimplifierTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.google.caja.util.CajaTestCase
              extended by com.google.caja.ancillary.opt.StatementSimplifierTest
All Implemented Interfaces:
junit.framework.Test

public class StatementSimplifierTest
extends CajaTestCase


Field Summary
 
Fields inherited from class com.google.caja.util.CajaTestCase
is, mc, mq, SEED
 
Constructor Summary
StatementSimplifierTest()
           
 
Method Summary
private  void assertSimplified(java.util.List<java.lang.String> expected, java.util.List<java.lang.String> input)
           
private  java.lang.String norm(java.lang.String code)
           
private  java.lang.String optFlow(java.lang.String code)
           
private static java.lang.String renderBody(Block bl)
           
private static java.lang.String renderStmt(Statement s)
           
 void testBlockTruncating1()
           
 void testBlockTruncating2()
           
 void testBlockTruncating3()
           
 void testCondOptimization1()
           
 void testCondOptimization2()
           
 void testCondOptimization3a()
           
 void testCondOptimization3b()
           
 void testCondOptimization3c()
           
 void testCondOptimization3d()
           
 void testCondOptimization4a()
           
 void testCondOptimization4b()
           
 void testCondOptimization5()
           
 void testCondOptimization6()
           
 void testCondOptimization7()
           
 void testCondOptimization8a()
           
 void testCondOptimization8b()
           
 void testCondOptimization8c()
           
 void testCondOptimization8d()
           
 void testCondOptimizationComposes1()
           
 void testCondOptimizationComposes2()
           
 void testDeadCode()
           
 void testExits()
           
 void testExpressionStmtsOptimized()
           
 void testExprStmtsSimplified()
           
 void testExtraneousBlocks()
           
 void testHandingConds()
           
 void testLabelRenaming()
           
 void testMaskLabel()
           
 void testMultiCondOpts()
           
 void testNestedBlocks()
           
 void testNoops()
           
 void testNotFoldableToTernary()
           
 void testOptimizeExpressionFlow()
           
 void testRequiredBlocks()
           
 void testReturnValueVisited()
           
 void testSwitchBlocks1()
           
 void testSwitchBlocks3a()
           
 void testSwitchBlocks3b()
           
 void testSwitchBlocks4()
           
 void testSwitchBlocks5()
           
 void testSwitchBlocks6()
           
 void testSwitchBlocks7()
           
 void testSwitchBlocks8()
           
 void testSwitchBlocks9()
           
 void testUnknownLabel()
           
 void testUnnecessaryElses()
           
 void testUselessLabel1()
           
 void testUselessLabel2()
           
 
Methods inherited from class com.google.caja.util.CajaTestCase
assertArrayEquals, assertCloneable, assertDeepEquals, assertMessage, assertMessage, assertMessagesLessSevereThan, assertNoErrors, assertNoMessage, assertNoWarnings, checkHeadless, css, css, cssDecls, cssDecls, dataFromResource, formatShort, fromResource, fromResource, fromString, fromString, fromString, html, htmlFragment, js, js, js, jsExpr, jsExpr, markup, markupFragment, minify, plain, quasi, render, render, renderProgram, runTest, setUp, tearDown, xml, xmlFragment
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatementSimplifierTest

public StatementSimplifierTest()
Method Detail

testExtraneousBlocks

public final void testExtraneousBlocks()
                                throws ParseException
Throws:
ParseException

testNestedBlocks

public final void testNestedBlocks()
                            throws ParseException
Throws:
ParseException

testNoops

public final void testNoops()
                     throws ParseException
Throws:
ParseException

testRequiredBlocks

public final void testRequiredBlocks()
                              throws ParseException
Throws:
ParseException

testExprStmtsSimplified

public final void testExprStmtsSimplified()
                                   throws ParseException
Throws:
ParseException

testCondOptimization1

public final void testCondOptimization1()
                                 throws ParseException
Throws:
ParseException

testCondOptimization2

public final void testCondOptimization2()
                                 throws ParseException
Throws:
ParseException

testCondOptimization3a

public final void testCondOptimization3a()
                                  throws ParseException
Throws:
ParseException

testCondOptimization3b

public final void testCondOptimization3b()
                                  throws ParseException
Throws:
ParseException

testCondOptimization3c

public final void testCondOptimization3c()
                                  throws ParseException
Throws:
ParseException

testCondOptimization3d

public final void testCondOptimization3d()
                                  throws ParseException
Throws:
ParseException

testCondOptimization4a

public final void testCondOptimization4a()
                                  throws ParseException
Throws:
ParseException

testCondOptimization4b

public final void testCondOptimization4b()
                                  throws ParseException
Throws:
ParseException

testCondOptimization5

public final void testCondOptimization5()
                                 throws ParseException
Throws:
ParseException

testCondOptimization6

public final void testCondOptimization6()
                                 throws ParseException
Throws:
ParseException

testCondOptimization7

public final void testCondOptimization7()
                                 throws ParseException
Throws:
ParseException

testCondOptimization8a

public final void testCondOptimization8a()
                                  throws ParseException
Throws:
ParseException

testCondOptimization8b

public final void testCondOptimization8b()
                                  throws ParseException
Throws:
ParseException

testCondOptimization8c

public final void testCondOptimization8c()
                                  throws ParseException
Throws:
ParseException

testCondOptimization8d

public final void testCondOptimization8d()
                                  throws ParseException
Throws:
ParseException

testNotFoldableToTernary

public final void testNotFoldableToTernary()
                                    throws ParseException
Throws:
ParseException

testCondOptimizationComposes1

public final void testCondOptimizationComposes1()
                                         throws ParseException
Throws:
ParseException

testCondOptimizationComposes2

public final void testCondOptimizationComposes2()
                                         throws ParseException
Throws:
ParseException

testMultiCondOpts

public final void testMultiCondOpts()
                             throws ParseException
Throws:
ParseException

testHandingConds

public final void testHandingConds()
                            throws ParseException
Throws:
ParseException

testUnnecessaryElses

public final void testUnnecessaryElses()
                                throws ParseException
Throws:
ParseException

testLabelRenaming

public final void testLabelRenaming()
                             throws ParseException
Throws:
ParseException

testUnknownLabel

public final void testUnknownLabel()
                            throws ParseException
Throws:
ParseException

testUselessLabel1

public final void testUselessLabel1()
                             throws ParseException
Throws:
ParseException

testUselessLabel2

public final void testUselessLabel2()
                             throws ParseException
Throws:
ParseException

testMaskLabel

public final void testMaskLabel()
                         throws ParseException
Throws:
ParseException

testDeadCode

public final void testDeadCode()
                        throws ParseException
Throws:
ParseException

testSwitchBlocks1

public final void testSwitchBlocks1()
                             throws ParseException
Throws:
ParseException

testSwitchBlocks3a

public final void testSwitchBlocks3a()
                              throws ParseException
Throws:
ParseException

testSwitchBlocks3b

public final void testSwitchBlocks3b()
                              throws ParseException
Throws:
ParseException

testSwitchBlocks4

public final void testSwitchBlocks4()
                             throws ParseException
Throws:
ParseException

testSwitchBlocks5

public final void testSwitchBlocks5()
                             throws ParseException
Throws:
ParseException

testSwitchBlocks6

public final void testSwitchBlocks6()
                             throws ParseException
Throws:
ParseException

testSwitchBlocks7

public final void testSwitchBlocks7()
                             throws ParseException
Throws:
ParseException

testSwitchBlocks8

public final void testSwitchBlocks8()
                             throws ParseException
Throws:
ParseException

testSwitchBlocks9

public final void testSwitchBlocks9()
                             throws ParseException
Throws:
ParseException

testReturnValueVisited

public final void testReturnValueVisited()
                                  throws ParseException
Throws:
ParseException

testBlockTruncating1

public final void testBlockTruncating1()
                                throws ParseException
Throws:
ParseException

testBlockTruncating2

public final void testBlockTruncating2()
                                throws ParseException
Throws:
ParseException

testBlockTruncating3

public final void testBlockTruncating3()
                                throws ParseException
Throws:
ParseException

testExpressionStmtsOptimized

public final void testExpressionStmtsOptimized()
                                        throws ParseException
Throws:
ParseException

testOptimizeExpressionFlow

public final void testOptimizeExpressionFlow()
                                      throws ParseException
Throws:
ParseException

testExits

public final void testExits()
                     throws ParseException
Throws:
ParseException

optFlow

private java.lang.String optFlow(java.lang.String code)
                          throws ParseException
Throws:
ParseException

norm

private java.lang.String norm(java.lang.String code)
                       throws ParseException
Throws:
ParseException

assertSimplified

private void assertSimplified(java.util.List<java.lang.String> expected,
                              java.util.List<java.lang.String> input)
                       throws ParseException
Throws:
ParseException

renderBody

private static java.lang.String renderBody(Block bl)

renderStmt

private static java.lang.String renderStmt(Statement s)


Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0