File indexing completed on 2024-05-19 04:32:48

0001 /*
0002  *  Copyright 2004, The University of Toronto
0003  *  Licensed under GPL.
0004  */
0005 
0006 #include "ksttestcase.h"
0007 
0008 static void exitHelper() {
0009   KST::vectorList.clear();
0010   KST::scalarList.clear();
0011   KST::dataObjectList.clear();
0012 }
0013 
0014 
0015 int rc = KstTestSuccess;
0016 
0017 #define doTest(x) testAssert(x, QString("Line %1").arg(__LINE__))
0018 #define doTestD(x, y) testAssert(x, QString("%1: %2").arg(__LINE__).arg(y))
0019 
0020 void testAssert(bool result, const QString& text = "Unknown") {
0021   if (!result) {
0022     KstTestFailed();
0023     printf("Test [%s] failed.\n", text.latin1());
0024   }
0025 }
0026     
0027 
0028 void doTests() {
0029 }
0030 
0031 
0032 int main(int argc, char **argv) {
0033   atexit(exitHelper);
0034 
0035   KApplication app(argc, argv, "testtemplate", false, false);
0036 
0037   doTests();
0038   // Don't put tests in main because we need to ensure that no KstObjects
0039   // remain past the exit handler
0040 
0041   exitHelper(); // need to run it here before kapp goes away in some cases.
0042   if (rc == KstTestSuccess) {
0043     printf("All tests passed!\n");
0044   }
0045   return -rc;
0046 }
0047 
0048 // vim: ts=2 sw=2 et