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