TEST_F(TypeParserTests, TestSizedIntArrayDataTypeParsing) { this->setInput("[3]Int a"); DataType type = this->typeParser()->parseType(); ASSERT_EQ(DataType::Array, type.kind()); ASSERT_EQ(3, type.arrayCount()); ASSERT_EQ(1, type.subtypeCount()); ASSERT_EQ(DataType::Integer, type.subtypeAtIndex(0).kind()); ASSERT_EQ(0, type.subtypeAtIndex(0).subtypeCount()); ASSERT_EQ("a", this->peek().str()); }
TEST_F(TypeParserTests, ArrayOfPointersToIntParsing) { this->setInput("[3]*Int a\n"); DataType type = this->typeParser()->parseType(); ASSERT_EQ(DataType::Array, type.kind()); ASSERT_EQ(3, type.arrayCount()); ASSERT_EQ(1, type.subtypeCount()); ASSERT_EQ(DataType::Pointer, type.subtypeAtIndex(0).kind()); ASSERT_EQ(1, type.subtypeAtIndex(0).subtypeCount()); ASSERT_EQ(DataType::Integer, type.subtypeAtIndex(0).subtypeAtIndex(0).kind()); ASSERT_EQ("a", this->peek().str()); }