Example #1
0
void UnityTestRunner(unityfunction * setup,
        unityTestfunction * body,
        unityTestfunction * teardown,
        const char * printableName,
        const char * group,
        const char * name,
        const char * file, int line, struct _Unity * const unity_p)
{
    if (testSelected(name, unity_p) && groupSelected(group, unity_p))
    {
        unity_p->CurrentTestFailed = 0;
        unity_p->TestFile = file;
        unity_p->CurrentTestName = printableName;
        unity_p->CurrentTestLineNumber = line;
        if (!unity_p->Verbose)
            UNITY_OUTPUT_CHAR('.');
        else
            UnityPrint(printableName, unity_p);

        unity_p->NumberOfTests++;
#if defined(UNITY_DYNAMIC_MEM_DEBUG)
        UnityMalloc_StartTest();
#endif
#if defined(UNITY_CPP_UNIT_COMPAT)
        UnityPointer_Init(unity_p);
#endif 
        runTestCase(unity_p);
        /* remember setup has failed - skip teardown if so*/
        bool hasSetupFailed = false;
        if (TEST_PROTECT())
        {
            setup(unity_p);
            /*DX_PATCH for jumpless version. If setup failed don't perform the test*/
            if (!unity_p->CurrentTestFailed) 
            {
                body(unity_p->testLocalStorage, unity_p);
            }
            else
            {
                hasSetupFailed  = true;
            }
        }
        if (TEST_PROTECT() && !hasSetupFailed )
        {
            teardown(unity_p->testLocalStorage, unity_p);
        }
        if (TEST_PROTECT())
        {
#if defined(UNITY_CPP_UNIT_COMPAT)
            UnityPointer_UndoAllSets(unity_p);
#endif
#if defined(UNITY_DYNAMIC_MEM_DEBUG)
            if (!unity_p->CurrentTestFailed)
                UnityMalloc_EndTest(unity_p);
#endif
        }
        UnityConcludeFixtureTest(unity_p);
    }
}
Example #2
0
	void run ()
	{
		Result result;
		std::chrono::time_point<std::chrono::system_clock> start, end;
		start = std::chrono::system_clock::now ();
		for (auto& it : UnitTestRegistry::instance ())
		{
			result += runTestCase (std::move (it));
		}
		end = std::chrono::system_clock::now ();
		print ("\nDone running %d tests in %lldms. [%d Failed]\n", result.succeded+result.failed, std::chrono::duration_cast<std::chrono::milliseconds> (end-start).count (), result.failed);
		printOutput ();
	}
Example #3
0
  bool TestRunner::visit(TestCase& test)
  {
    if (m_context->shouldStop())
      return false;
    if (!shouldVisit(currentPath() + test.name()))
      return false;

    int rst = runTestCase(test, *m_context, logS());
    if( 0 != rst )
        m_failures++;
    
    m_tests++;
    // Always continue, regardless of test result, unless the context
    // object says otherwise.
    return !m_context->shouldStop();
  }
Example #4
0
void UnityTestRunner(unityfunction* setup,
        unityfunction* testBody,
        unityfunction* teardown,
        const char * printableName,
        const char * group,
        const char * name,
        const char * file, int line)
{
    if (testSelected(name) && groupSelected(group))
    {
        Unity.CurrentTestFailed = 0;
        Unity.TestFile = file;
        Unity.CurrentTestName = printableName;
        Unity.CurrentTestLineNumber = line;
        if (!UnityFixture.Verbose)
            UNITY_OUTPUT_CHAR('.');
        else
            UnityPrint(printableName);

        Unity.NumberOfTests++;
        UnityMalloc_StartTest();
        UnityPointer_Init();

        runTestCase();
        if (TEST_PROTECT())
        {
            setup();
            testBody();
        }
        if (TEST_PROTECT())
        {
            teardown();
        }
        if (TEST_PROTECT())
        {
            UnityPointer_UndoAllSets();
            if (!Unity.CurrentTestFailed)
                UnityMalloc_EndTest();
            UnityConcludeFixtureTest();
        }
        else
        {
            //aborting - jwg - di i need these for the other TEST_PROTECTS?
        }
    }
}
Example #5
0
int main(void)
{
  std::cout << "============================ selectDevice(NULL) ===============================" << std::endl;
  runTestCase(NULL);

  #define TEST(opt) \
    { \
      std::cout << "============================ selectDevice(" #opt ") ===============================" << std::endl; \
      uint32_t __tmp = (opt); \
      runTestCase(&__tmp); \
    }

  TEST(OpenCL::OPT_PLATFORM_PREFER_INTEL);
  TEST(OpenCL::OPT_PLATFORM_PREFER_INTEL | OpenCL::OPT_DEVICE_PREFER_ANY);
  TEST(OpenCL::OPT_PLATFORM_PREFER_ANY | OpenCL::OPT_DEVICE_PREFER_GPU);
  TEST(OpenCL::OPT_PLATFORM_PREFER_ANY | OpenCL::OPT_DEVICE_PREFER_CPU);

  #undef TEST

  return 0;
}
Example #6
0
void basicTest() {
    CASE cases[] = {
        {ADD_FRONT, 2, SUCCESS},
        {ADD_FRONT, 1, SUCCESS},
        {ADD_FRONT, 0, SUCCESS},
        {ADD_BACK, 3, SUCCESS},
        {ADD_BACK, 4, SUCCESS},
        {SIZE, 0, 5},
        {REMOVE_FRONT, 0, 0},
        {REMOVE_FRONT, 0, 1},
        {REMOVE_BACK, 0, 4},
        {SIZE, 0, 2},
        {REMOVE_BACK, 0, 3},
        {REMOVE_BACK, 0, 2},
        {SIZE, 0, 0},
    };
    linked_list* list = initLinkedList();
    for (int i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
        if (runTestCase(&(cases[i]), list)) {
            printf("failure on case: %d\n", i);
        }
    }
    freeLinkedList(list);
}
Example #7
0
void TestCase::run(TestResult& result) {
  result_ = &result;
  runTestCase();
}
Example #8
0
void runWebTagInfoTest()
{
     runTestCase("testWebTagInfo","WebTagInfo.log");
}
Example #9
0
void QBT_Do(QBox_Client* client)
{
	genTestCase();
	runTestCase(client);
	delTestCase();
}
Example #10
0
void runXmlParserTest()
{
     runTestCase("testXmlParser","xmlParserTestResult.log");
}