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