MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / TEST

Function TEST

src/SourceCompile/ParseFile_test.cpp:27–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26namespace {
27TEST(ParserTest, BasicParse) {
28 ParserHarness harness;
29 {
30 auto fC = harness.parse("module top(); assign a = b; endmodule");
31 NodeId root = fC->getRootNode();
32 NodeId assign = fC->sl_collect(root, VObjectType::paContinuous_assign);
33 EXPECT_TRUE(assign);
34 }
35 {
36 auto fC = harness.parse("module top(); assign a = !b; endmodule");
37 NodeId root = fC->getRootNode();
38 NodeId assign = fC->sl_collect(root, VObjectType::paContinuous_assign);
39 /*
40 n<> u<10> t<Net_lvalue> p<17> c<7> s<16> l<1:22> el<1:23>
41 n<b> u<11> t<StringConst> p<12> l<1:27> el<1:28>
42 n<> u<12> t<Primary_literal> p<13> c<11> l<1:27> el<1:28>
43 n<> u<13> t<Primary> p<14> c<12> l<1:27> el<1:28>
44 n<> u<14> t<Expression> p<16> c<13> l<1:27> el<1:28>
45 n<> u<15> t<Unary_Not> p<16> s<14> l<1:26> el<1:27>
46 n<> u<16> t<Expression> p<17> c<15> l<1:26> el<1:28>
47 n<> u<17> t<Net_assignment> p<18> c<10> l<1:22> el<1:28>
48 n<> u<18> t<List_of_net_assignments> p<19> c<17> l<1:22> el<1:28>
49 n<> u<19> t<Continuous_assign> p<20> c<18> l<1:15> el<1:29>
50 */
51 NodeId List_of_net_assignments = fC->Child(assign);
52 NodeId Net_assignment = fC->Child(List_of_net_assignments);
53 NodeId Net_lvalue = fC->Child(Net_assignment);
54 NodeId Expression = fC->Sibling(Net_lvalue);
55 NodeId Unary_Not = fC->Child(Expression);
56 EXPECT_EQ(fC->Type(Unary_Not), VObjectType::paUnary_Not);
57 }
58}
59} // namespace
60} // namespace SURELOG

Callers

nothing calls this directly

Calls 6

parseMethod · 0.45
getRootNodeMethod · 0.45
sl_collectMethod · 0.45
ChildMethod · 0.45
SiblingMethod · 0.45
TypeMethod · 0.45

Tested by

no test coverage detected