From 9c69a86ed94732196c2b62209f61da783cda1386 Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Thu, 19 Nov 2015 12:46:48 +0200 Subject: another small test --- src/gtest/trex_stateless_gtest.cpp | 83 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'src') diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp index 93e8387f..ac0a5e63 100644 --- a/src/gtest/trex_stateless_gtest.cpp +++ b/src/gtest/trex_stateless_gtest.cpp @@ -225,6 +225,89 @@ TEST_F(basic_stl, load_pcap_file) { +TEST_F(basic_stl, simple_prog4) { + + CBasicStl t1; + CParserOption * po =&CGlobalInfo::m_options; + po->preview.setVMode(7); + po->preview.setFileWrite(true); + po->out_file ="exp/stl_simple_prog4"; + + TrexStreamsCompiler compile; + + + std::vector streams; + + + /* stream0 */ + TrexStream * stream0 = new TrexStream(TrexStream::stCONTINUOUS, 0,300); + stream0->set_pps(1.0); + stream0->m_enabled = true; + stream0->m_self_start = true; + + CPcapLoader pcap; + pcap.load_pcap_file("cap2/udp_64B.pcap",0); + pcap.update_ip_src(0x10000000); + pcap.clone_packet_into_stream(stream0); + streams.push_back(stream0); + + + /* stream1 */ + TrexStream * stream1 = new TrexStream(TrexStream::stSINGLE_BURST, 0,100); + stream1->set_pps(1.0); + stream1->set_single_burst(5); + stream1->m_enabled = true; + stream1->m_self_start = true; + stream1->m_next_stream_id=200; + + pcap.load_pcap_file("cap2/udp_64B.pcap",0); + pcap.update_ip_src(0x10000001); + pcap.clone_packet_into_stream(stream1); + + streams.push_back(stream1); + + + /* stream1 */ + + TrexStream * stream2 = new TrexStream(TrexStream::stMULTI_BURST, 0,200); + stream2->set_pps(1.0); + stream2->m_isg_usec = 1000000; /*time betwean stream 1 to stream 2 */ + stream2->m_enabled = true; + stream2->m_self_start = false; + stream2->set_multi_burst(5, + 3, + 2000000.0); + + // next stream is 100 - loop + stream2->m_next_stream_id=100; + + + pcap.load_pcap_file("cap2/udp_64B.pcap",0); + pcap.update_ip_src(0x10000002); + pcap.clone_packet_into_stream(stream2); + streams.push_back(stream2); + + + TrexStreamsCompiledObj comp_obj(0,1.0); + + EXPECT_TRUE(compile.compile(streams, comp_obj) ); + + TrexStatelessDpStart * lpstart = new TrexStatelessDpStart( comp_obj.clone(), 20.0 ); + + + t1.m_msg = lpstart; + + bool res=t1.init(); + + delete stream0 ; + delete stream1 ; + delete stream2 ; + + EXPECT_EQ_UINT32(1, res?1:0)<< "pass"; +} + + + TEST_F(basic_stl, simple_prog3) { CBasicStl t1; -- cgit 1.2.3-korg