NBTrafficLightLogicTest.cpp

Go to the documentation of this file.
00001 #include <gtest/gtest.h>
00002 #include <netbuild/NBTrafficLightLogic.h>
00003 #include "../utils/iodevices/OutputDeviceMock.h"
00004 
00005 using namespace std;
00006 
00007 /*
00008 Tests the class NBTrafficLightLogic 
00009 */
00010 
00011 /* Test the method 'writeXML'*/
00012 TEST(NBTrafficLightLogic, test_method_writeXML) {   
00013     
00014     NBTrafficLightLogic *edge = new NBTrafficLightLogic("1","11",2);
00015     edge->addStep(3,"a");
00016     OutputDeviceMock *mock = new OutputDeviceMock();
00017     edge->writeXML(*mock);
00018     string expect = "   <tl-logic id=\"1\" type=\"static\" programID=\"11\" offset=\"0\">\n      <phase duration=\"3\" state=\"a\"/>\n   </tl-logic>\n\n";
00019     EXPECT_EQ(expect, mock->getString());
00020 }
00021 
00022 /* Test the method 'getDuration'*/
00023 TEST(NBTrafficLightLogic, test_method_getDuration) {    
00024     NBTrafficLightLogic *edge = new NBTrafficLightLogic("1","11",2);
00025     EXPECT_EQ(0, edge->getDuration());
00026 
00027     edge->addStep(3,"a");
00028     edge->addStep(5,"b");
00029     EXPECT_EQ(8, edge->getDuration());
00030     
00031 }

Generated on Wed May 5 00:06:33 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6