com.google.caja.ancillary.opt
Class ParseTreeKBTest

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.ParseTreeKBTest
All Implemented Interfaces:
junit.framework.Test

public class ParseTreeKBTest
extends CajaTestCase


Field Summary
(package private)  ParseTreeKB kb
           
(package private)  java.util.List<Pair<Expression,Fact>> knowledge
           
 
Fields inherited from class com.google.caja.util.CajaTestCase
is, mc, mq, SEED
 
Constructor Summary
ParseTreeKBTest()
           
 
Method Summary
private  void addFact(java.lang.String expr, java.lang.String value)
           
private  void addFuzzyFact(java.lang.String expr, boolean truthy)
           
private  void assertFacts(boolean finish, java.lang.String... expected)
           
private  void assertFacts(java.lang.String... expected)
           
private  void checkGlobalFolding()
           
private static java.lang.String renderMin(Block js)
           
protected  void setUp()
           
 void testAnd1()
           
 void testAnd2()
           
 void testComparisons1()
           
 void testComparisons2()
           
 void testComparisons3()
           
 void testComparisons4()
           
 void testComparisons5()
           
 void testComparisonsToSpecials()
           
 void testDemorgans()
           
 void testEquality()
           
 void testEquivalence()
           
 void testFolding()
           
 void testFoldingPreservesSideEffects()
           
 void testGlobalExistence()
           
 void testGlobalFolding1()
           
 void testGlobalFolding2()
           
 void testGlobalObject()
           
 void testHookOptimization()
           
 void testInlining1()
           
 void testInlining2()
           
 void testInlining3()
           
 void testInstanceof()
           
 void testLocalVariableReferences1()
           
 void testLocalVariableReferences2()
           
 void testLogicalOperatorsFuzzy1()
           
 void testLogicalOperatorsFuzzy2()
           
 void testLogicalOperatorsFuzzy3()
           
 void testMemberAccess()
           
 void testNoOperandSwitching1()
           
 void testNot1()
           
 void testNot2()
           
 void testOperandSwitching1()
           
 void testOptimizeOutGlobals1()
           
 void testOptimizeOutGlobals2()
           
 void testOptimizeOutGlobals3()
           
 void testOptimizeOutMiddleConditional()
           
 void testOptimizeOutMiddlePreservingSideEffect()
           
 void testOptimizeOutSimpleConditional()
           
 void testOptimizeOutTail()
           
 void testOptimizeOutTailPreservingSideEffect()
           
 void testPropertyNamesNotOptimized()
           
 void testReplacement()
           
 void testSpecialFloatingValues()
           
 void testTypeof1()
           
 void testTypeof2()
           
 void testTypeof3()
           
 void testTypeof4()
           
 void testTypeof5()
           
 void testTypeofKnowledge()
           
 
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, 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
 

Field Detail

knowledge

java.util.List<Pair<Expression,Fact>> knowledge

kb

ParseTreeKB kb
Constructor Detail

ParseTreeKBTest

public ParseTreeKBTest()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class CajaTestCase
Throws:
java.lang.Exception

testTypeof1

public final void testTypeof1()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testTypeof2

public final void testTypeof2()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testTypeof3

public final void testTypeof3()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testTypeof4

public final void testTypeof4()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testTypeof5

public final void testTypeof5()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testNot1

public final void testNot1()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testNot2

public final void testNot2()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testComparisons1

public final void testComparisons1()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testComparisons2

public final void testComparisons2()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testComparisons3

public final void testComparisons3()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testComparisons4

public final void testComparisons4()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testComparisons5

public final void testComparisons5()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testInstanceof

public final void testInstanceof()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testEquivalence

public final void testEquivalence()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testEquality

public final void testEquality()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testAnd1

public final void testAnd1()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testAnd2

public final void testAnd2()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testDemorgans

public final void testDemorgans()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testOperandSwitching1

public final void testOperandSwitching1()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testNoOperandSwitching1

public final void testNoOperandSwitching1()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testGlobalObject

public final void testGlobalObject()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testSpecialFloatingValues

public final void testSpecialFloatingValues()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testGlobalExistence

public final void testGlobalExistence()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testReplacement

public final void testReplacement()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutSimpleConditional

public final void testOptimizeOutSimpleConditional()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutMiddleConditional

public final void testOptimizeOutMiddleConditional()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutTail

public final void testOptimizeOutTail()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutTailPreservingSideEffect

public final void testOptimizeOutTailPreservingSideEffect()
                                                   throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutMiddlePreservingSideEffect

public final void testOptimizeOutMiddlePreservingSideEffect()
                                                     throws java.lang.Exception
Throws:
java.lang.Exception

testLogicalOperatorsFuzzy1

public final void testLogicalOperatorsFuzzy1()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

testLogicalOperatorsFuzzy2

public final void testLogicalOperatorsFuzzy2()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

testLogicalOperatorsFuzzy3

public final void testLogicalOperatorsFuzzy3()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

testFoldingPreservesSideEffects

public final void testFoldingPreservesSideEffects()
                                           throws java.lang.Exception
Throws:
java.lang.Exception

testPropertyNamesNotOptimized

public final void testPropertyNamesNotOptimized()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

testMemberAccess

public final void testMemberAccess()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testLocalVariableReferences1

public final void testLocalVariableReferences1()
                                        throws java.lang.Exception
Throws:
java.lang.Exception

testLocalVariableReferences2

public final void testLocalVariableReferences2()
                                        throws java.lang.Exception
Throws:
java.lang.Exception

testInlining1

public final void testInlining1()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testInlining2

public final void testInlining2()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testInlining3

public final void testInlining3()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testTypeofKnowledge

public final void testTypeofKnowledge()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testHookOptimization

public final void testHookOptimization()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testGlobalFolding1

public final void testGlobalFolding1()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testGlobalFolding2

public final void testGlobalFolding2()
                              throws java.lang.Exception
Throws:
java.lang.Exception

checkGlobalFolding

private void checkGlobalFolding()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutGlobals1

public final void testOptimizeOutGlobals1()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutGlobals2

public final void testOptimizeOutGlobals2()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testOptimizeOutGlobals3

public final void testOptimizeOutGlobals3()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testComparisonsToSpecials

public final void testComparisonsToSpecials()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testFolding

public final void testFolding()
                       throws java.lang.Exception
Throws:
java.lang.Exception

addFact

private void addFact(java.lang.String expr,
                     java.lang.String value)
              throws ParseException
Throws:
ParseException

addFuzzyFact

private void addFuzzyFact(java.lang.String expr,
                          boolean truthy)
                   throws ParseException
Throws:
ParseException

assertFacts

private void assertFacts(java.lang.String... expected)

assertFacts

private void assertFacts(boolean finish,
                         java.lang.String... expected)

renderMin

private static java.lang.String renderMin(Block js)


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