예제 #1
0
TEST(FlowGraph, AssertInvalidDescriptor){
	m3bp::FlowGraph graph;
	EXPECT_THROW(
		graph.add_edge(
			m3bp::OutputPortDescriptor(),
			m3bp::InputPortDescriptor()),
		std::invalid_argument);
	const auto src = graph.add_vertex(
		"src", OutputOnlyProcessor<false>());
	const auto dst = graph.add_vertex(
		"dst", InputOnlyProcessor<m3bp::Movement::ONE_TO_ONE>());
	EXPECT_THROW(src.input_port(0),  std::out_of_range);
	EXPECT_THROW(src.output_port(1), std::out_of_range);
	EXPECT_THROW(dst.input_port(1),  std::out_of_range);
	EXPECT_THROW(dst.output_port(0), std::out_of_range);
	EXPECT_THROW(
		graph.add_edge(
			m3bp::OutputPortDescriptor(),
			dst.input_port(0)),
		std::invalid_argument);
	EXPECT_THROW(
		graph.add_edge(
			src.output_port(0),
			m3bp::InputPortDescriptor()),
		std::invalid_argument);
}
예제 #2
0
TEST(FlowGraph, CycleDetection){
	m3bp::FlowGraph graph;
	auto v0 = graph.add_vertex(
		"v0", InOutProcessor<m3bp::Movement::ONE_TO_ONE>());
	auto v1 = graph.add_vertex(
		"v1", InOutProcessor<m3bp::Movement::ONE_TO_ONE>());
	auto v2 = graph.add_vertex(
		"v2", InOutProcessor<m3bp::Movement::ONE_TO_ONE>());
	graph.add_edge(v0.output_port(0), v1.input_port(0));
	graph.add_edge(v1.output_port(0), v2.input_port(0));
	graph.add_edge(v2.output_port(0), v0.input_port(0));
	m3bp::Context ctx;
	EXPECT_THROW(ctx.set_flow_graph(graph), m3bp::RoutingError);
}
예제 #3
0
int CheckForPort( int i, char value )
{
    int         j;

    output_port( PortTest[ i ], value );
    for( j = 100; j != 0; j-- );
    return( input_port( PortTest[ i ] ) == value );
}