plc/plc_test.h

00001 #ifndef _PLCTEST_H
00002 #define _PLCTEST_H
00003 
00004 #include "gridlabd.h"
00005 #include "test_framework.h"
00006 
00007 #include "test_callbacks.h"
00008 #include "plc.h"
00009 
00023 class plc_module_test : public test_helper
00024 {
00025     OBJECT *obj;
00026 public:
00027     plc_module_test(){}
00028 
00033     void setup()
00034     {
00035         //MODULE* mod = find_module("plc");
00036     }
00037 
00047     void test_create()
00048     {
00049         CLASS *cl = get_class_by_name("plc");
00050         CPPUNIT_ASSERT(cl != NULL);
00051         obj = gl_create_object(cl,sizeof(plc));
00052         CPPUNIT_ASSERT(obj != NULL);
00053 
00054         // TODO: Need to attach a TMY Tape object before this call will actually work without blowing up.
00055         //TIMESTAMP ts = myobject_sync(obj,get_global_clock(),0x01);
00056 
00057         double *pTout;
00058         double *pRhout;
00059         double *pSolar;
00060         // TODO: Fill in when lookup functions are complete
00061         // Get property values for comparison.
00062         pTout = (double*)GETADDR(obj,gl_get_property(obj,"temperature"));
00063         pRhout = (double*)GETADDR(obj,gl_get_property(obj,"humidity"));
00064         pSolar = (double*)GETADDR(obj,gl_get_property(obj,"solar_flux"));
00065     }
00066 
00067     /*
00068      * This section creates the suite() method that will be used by the
00069      * CPPUnit testrunner to execute the tests that we have registered.
00070      * This section needs to be in the .h file
00071      */
00072     CPPUNIT_TEST_SUITE(plc_module_test);
00073     /*
00074      * For each test method defined above, we should have a separate
00075      * CPPUNIT_TEST() line.
00076      */
00077     CPPUNIT_TEST(test_create);
00078     CPPUNIT_TEST_SUITE_END();
00079 };
00080 
00081 /*
00082  * Registers the test suite with the CPPUnit registration factory.  In most
00083  * cases, this is all that is required for it to be included and run by the
00084  * module_test method in test.cpp.
00085  */
00086 CPPUNIT_TEST_SUITE_REGISTRATION(plc_module_test);
00087 
00088 #endif
00089 

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy