Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Nov 29, 2023
1 parent 9b9354f commit 5185b4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1055,19 +1055,19 @@ internal class CXXLanguageFrontendTest : BaseTest() {
it.registerLanguage<CPPLanguage>()
}

// should be four method nodes
assertEquals(2, declaration.declarations.size)

val method = declaration.getDeclarationAs(1, FunctionDeclaration::class.java)
assertEquals("main()int", method!!.signature)
val method = declaration.functions["main"]
assertNotNull(method)
assertEquals("main()int", method.signature)
assertTrue(method.body is Block)

val statements = (method.body as Block).statements
assertEquals(6, statements.size)
assertTrue(statements[0] is DeclarationStatement)
assertTrue(statements[1] is DeclarationStatement)
assertTrue(statements[2] is DeclarationStatement)
assertTrue(statements[3] is ReturnStatement)
assertTrue(statements[3] is DeclarationStatement)
assertTrue(statements[4] is DeclarationStatement)
assertTrue(statements[5] is ReturnStatement)

var initializer =
((statements[0] as DeclarationStatement).singleDeclaration as VariableDeclaration)
Expand Down Expand Up @@ -1110,7 +1110,7 @@ internal class CXXLanguageFrontendTest : BaseTest() {
assertEquals(20, (die.rhs[0] as Literal<*>).value)

initializer =
((statements[2] as DeclarationStatement).singleDeclaration as VariableDeclaration)
((statements[3] as DeclarationStatement).singleDeclaration as VariableDeclaration)
.initializer
assertTrue(initializer is InitializerListExpression)
assertEquals(2, initializer.initializers.size)
Expand All @@ -1128,6 +1128,9 @@ internal class CXXLanguageFrontendTest : BaseTest() {
assertTrue(die.rhs[0] is Literal<*>)
assertEquals(5, (die.lhs[0] as Literal<*>).value)
assertEquals(2, (die.rhs[0] as Literal<*>).value)

val o = declaration.variables["o"]
assertNotNull(o)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

struct Outer {
struct Point p;
}
};

struct Point
{
Expand Down

0 comments on commit 5185b4b

Please sign in to comment.