本文整理汇总了C++中DFA::withoutDeadStates方法的典型用法代码示例。如果您正苦于以下问题:C++ DFA::withoutDeadStates方法的具体用法?C++ DFA::withoutDeadStates怎么用?C++ DFA::withoutDeadStates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DFA
的用法示例。
在下文中一共展示了DFA::withoutDeadStates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST_F(TestDFA, DeadStateRemoval) {
instance << "q0";
instance << "q1";
instance << "q2";
instance << "q3";
instance.addTransition("q0", "q1", 'a');
instance.addTransition("q1", "q2", 'b');
instance.addTransition("q2", "q2", 'c');
instance.addTransition("q3", "q3", 'd');
EXPECT_EQ(4, instance.size());
DFA other = instance.withoutDeadStates();
EXPECT_EQ(0, other.size());
instance.accept("q1");
other = instance.withoutDeadStates();
EXPECT_EQ(2, other.size());
EXPECT_EQ(other.initialState(), instance.initialState());
instance.accept("q3");
other = instance.withoutDeadStates();
EXPECT_EQ(3, other.size());
EXPECT_EQ(other.initialState(), instance.initialState());
DFA empty;
ASSERT_NO_THROW(empty.withoutDeadStates());
EXPECT_EQ(0, empty.withoutDeadStates().size());
}