Ejemplo n.º 1
0
 def testNoFunctionIfNoPrivatePublicKeyword(self):
     concepts = parseConcepts("void helloWorld() ")
     self.assertNotIn(Concept.FUNCTION, concepts)
Ejemplo n.º 2
0
 def testParseReturn(self):
     concepts = parseConcepts("return String();")
     self.assertIn(Concept.RETURN, concepts)
Ejemplo n.º 3
0
 def testParseNewStatement(self):
     concepts = parseConcepts("String b = new String();")
     self.assertIn(Concept.OBJECT, concepts)
Ejemplo n.º 4
0
 def testParseAssignmentFromEquals(self):
     concepts = parseConcepts("a = 2;")
     self.assertIn(Concept.ASSIGNMENT, concepts)
Ejemplo n.º 5
0
 def testParseIfStatement(self):
     concepts = parseConcepts("	if (i == 5) {")
     self.assertIn(Concept.CONDITIONAL, concepts)
Ejemplo n.º 6
0
 def testParseLessThan(self):
     concepts = parseConcepts("a = b < c;")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
Ejemplo n.º 7
0
 def testParseForWithNoSpaceBeforeParens(self):
     concepts = parseConcepts("for(int i = 0; i < 2; i++) {")
     self.assertIn(Concept.LOOP, concepts)
Ejemplo n.º 8
0
 def testFunctionDeclarationOpeningParenNoSemicolon(self):
     concepts = parseConcepts("public void helloWorld() ")
     self.assertIn(Concept.FUNCTION, concepts)
Ejemplo n.º 9
0
 def testNoFunctionIfNoPrivatePublicKeyword(self):
     concepts = parseConcepts("void helloWorld() ")
     self.assertNotIn(Concept.FUNCTION, concepts)
Ejemplo n.º 10
0
 def testParseLeftBracket(self):
     concepts = parseConcepts("int a = b[2];")
     self.assertIn(Concept.ARRAY, concepts)
Ejemplo n.º 11
0
 def testParseNewStatement(self):
     concepts = parseConcepts("String b = new String();")
     self.assertIn(Concept.OBJECT, concepts)
Ejemplo n.º 12
0
 def testParseReturn(self):
     concepts = parseConcepts("return String();")
     self.assertIn(Concept.RETURN, concepts)
Ejemplo n.º 13
0
 def testNoParseIfFromVarName(self):
     concepts = parseConcepts("int iffy = 5;")
     self.assertNotIn(Concept.CONDITIONAL, concepts)
Ejemplo n.º 14
0
 def testParseIfStatement(self):
     concepts = parseConcepts("	if (i == 5) {")
     self.assertIn(Concept.CONDITIONAL, concepts)
Ejemplo n.º 15
0
 def testParseMinus(self):
     concepts = parseConcepts("a = b - c;")
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 16
0
 def testNoFunctionIfEndsWithSemicolon(self):
     concepts = parseConcepts("helloWorld(1, 2);")
     self.assertNotIn(Concept.FUNCTION, concepts)
Ejemplo n.º 17
0
 def testParseSlash(self):
     concepts = parseConcepts("a = b / c;")
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 18
0
 def testParseMinus(self):
     concepts = parseConcepts("a = b - c;")
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 19
0
 def testParseRelOpAndArithOp(self):
     concepts = parseConcepts("a = (b > c + 5);")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 20
0
 def testParseTimes(self):
     concepts = parseConcepts("a = b * c;")
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 21
0
 def testNoParseDoubleEqualsRelational(self):
     concepts = parseConcepts("if (a == 3) {")
     self.assertNotIn(Concept.ASSIGNMENT, concepts)
Ejemplo n.º 22
0
 def testParseSlash(self):
     concepts = parseConcepts("a = b / c;")
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 23
0
 def testNoParseDoubleEqualsRelational(self):
     concepts = parseConcepts("if (a == 3) {")
     self.assertNotIn(Concept.ASSIGNMENT, concepts)
Ejemplo n.º 24
0
 def testParseGreaterThan(self):
     concepts = parseConcepts("a = b > c;")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
Ejemplo n.º 25
0
 def testNoParseIfFromVarName(self):
     concepts = parseConcepts("int iffy = 5;");
     self.assertNotIn(Concept.CONDITIONAL, concepts)
Ejemplo n.º 26
0
 def testParseLessThan(self):
     concepts = parseConcepts("a = b < c;")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
Ejemplo n.º 27
0
 def testParseLeftBracket(self):
     concepts = parseConcepts("int a = b[2];")
     self.assertIn(Concept.ARRAY, concepts)
Ejemplo n.º 28
0
 def testParseNotEquals(self):
     concepts = parseConcepts("a = b != c;")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
Ejemplo n.º 29
0
 def testFunctionDeclarationOpeningParenNoSemicolon(self):
     concepts = parseConcepts("public void helloWorld() ")
     self.assertIn(Concept.FUNCTION, concepts)
Ejemplo n.º 30
0
 def testParseRelOpAndArithOp(self):
     concepts = parseConcepts("a = (b > c + 5);")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 31
0
 def testNoFunctionIfEndsWithSemicolon(self):
     concepts = parseConcepts("helloWorld(1, 2);")
     self.assertNotIn(Concept.FUNCTION, concepts)
Ejemplo n.º 32
0
 def testParseForLoopAtStartOfLine(self):
     concepts = parseConcepts("for (int i = 0; i < 2; i++) {")
     self.assertIn(Concept.LOOP, concepts)
Ejemplo n.º 33
0
 def testParseTimes(self):
     concepts = parseConcepts("a = b * c;")
     self.assertIn(Concept.ARITHMETIC_OP, concepts)
Ejemplo n.º 34
0
 def testParseForWithNoSpaceBeforeParens(self):
     concepts = parseConcepts("for(int i = 0; i < 2; i++) {")
     self.assertIn(Concept.LOOP, concepts)
Ejemplo n.º 35
0
 def testParseGreaterThan(self):
     concepts = parseConcepts("a = b > c;")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
Ejemplo n.º 36
0
 def testParseWhileLoop(self):
     concepts = parseConcepts("while(i > 0)")
     self.assertIn(Concept.LOOP, concepts)
Ejemplo n.º 37
0
 def testParseNotEquals(self):
     concepts = parseConcepts("a = b != c;")
     self.assertIn(Concept.RELATIONAL_OP, concepts)
Ejemplo n.º 38
0
 def testNoParseForLoopFromVarname(self):
     concepts = parseConcepts("format = 2;")
     self.assertNotIn(Concept.LOOP, concepts)
Ejemplo n.º 39
0
 def testParseForLoopAtStartOfLine(self):
     concepts = parseConcepts("for (int i = 0; i < 2; i++) {")
     self.assertIn(Concept.LOOP, concepts)
Ejemplo n.º 40
0
 def testNoParseForLoopFromVarname(self):
     concepts = parseConcepts("format = 2;")
     self.assertNotIn(Concept.LOOP, concepts)
Ejemplo n.º 41
0
 def testParseWhileLoop(self):
     concepts = parseConcepts("while(i > 0)")
     self.assertIn(Concept.LOOP, concepts)
Ejemplo n.º 42
0
 def testParseAssignmentFromEquals(self):
     concepts = parseConcepts("a = 2;")
     self.assertIn(Concept.ASSIGNMENT, concepts)