Created
June 27, 2012 13:24
-
-
Save pghalliday/3004047 to your computer and use it in GitHub Desktop.
Blog - OOOCode - Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef IMYINTERFACE_H_ | |
#define IMYINTERFACE_H_ | |
#include "OOOCode.h" | |
#define OOOInterface IMyInterface | |
OOOVirtuals | |
OOOVirtual(int, getData); | |
OOOVirtualsEnd | |
#undef OOOInterface | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "opentv.h" | |
#include "assert.h" | |
#include "OOOUnitTestsRun.h" | |
void main(void) | |
{ | |
size_t uMemory = O_heap_available(); | |
OOODebug * pDebug = OOOConstruct(OOODebug); | |
OOODebugReporter * pReporter = OOOConstruct(OOODebugReporter, OOOCast(OOOIDebug, pDebug)); | |
OOOUnitTestsRun(OOOCast(OOOIReporter, pReporter)); | |
OOODestroy(pReporter); | |
OOODestroy(pDebug); | |
assert(O_heap_available() == uMemory); | |
/* Stick around so the VSTB does not exit and we know we ran everything */ | |
while (TRUE) | |
{ | |
o_message tMessage; | |
O_ui_get_event_wait(&tMessage); | |
if (O_msg_class(&tMessage) == MSG_CLASS_CONTROL) | |
{ | |
if (O_msg_type(&tMessage) == MSG_TYPE_QUIT) | |
{ | |
O_exit(); | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MyClass.h" | |
#define OOOClass MyClass | |
OOOPrivateData | |
int nMyField; | |
OOOPrivateDataEnd | |
OOODestructor | |
{ | |
} | |
OOODestructorEnd | |
OOOMethod(int, getMyField) | |
{ | |
return OOOF(nMyField); | |
} | |
OOOMethodEnd | |
OOOConstructor(int nMyField) | |
{ | |
OOOMapMethods | |
OOOMethodMapping(getMyField) | |
OOOMapMethodsEnd | |
OOOF(nMyField) = nMyField; | |
} | |
OOOConstructorEnd | |
#undef OOOClass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MYCLASS_H_ | |
#define MYCLASS_H_ | |
#include "OOOCode.h" | |
#define OOOClass MyClass | |
OOODeclare(int nMyField) | |
OOOImplements | |
OOOImplementsEnd | |
OOOExports | |
OOOExport(int, getMyField); | |
OOOExportsEnd | |
OOODeclareEnd | |
#undef OOOClass | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "OOOUnitTestDefines.h" | |
OOOTest(MyClass) | |
{ | |
OOOInfo("MyClass test"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OOOTest(MyClass) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "OOOUnitTestDefines.h" | |
#include "MyClass.h" | |
OOOTest(MyClass) | |
{ | |
MyClass * pMyClass = OOOConstruct(MyClass, 5); | |
/* Check stuff here */ | |
OOOCheck(OOOCall(pMyClass, getMyField) == 5); | |
OOOCheck(OOOICall(OOOCast(IMyInterface, pMyClass), getData) == 5); | |
OOODestroy(pMyClass); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "OOOUnitTestDefines.h" | |
#include "MyClass.h" | |
OOOTest(MyClass) | |
{ | |
MyClass * pMyClass = OOOConstruct(MyClass, 5); | |
/* Check stuff here */ | |
OOOCheck(OOOCall(pMyClass, getMyField) == 5); | |
OOODestroy(pMyClass); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* include test headers here */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MyClass.Test.h" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment