int main(int argc, char **argv) { QCoreApplication::setOrganizationName(QStringLiteral("StoiridhProject")); QCoreApplication::setApplicationName(QStringLiteral("test.stoiridh")); #if defined(QUICK_TEST_SOURCE_DIR) return quick_test_main(argc, argv, TEST_NAME(Test.Stoiridh.Settings), QUICK_TEST_SOURCE_DIR); #else return quick_test_main(argc, argv, TEST_NAME(Test.Stoiridh.Settings), nullptr); #endif }
static int unload_module(void) { AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, create)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_first)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_overflow)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, create)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_first)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_overflow)); AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order)); return 0; }
static int load_module(void) { AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, create)); AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_first)); AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put)); AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_overflow)); AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order)); AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, create)); AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_first)); AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put)); AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_overflow)); AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order)); return AST_MODULE_LOAD_SUCCESS; }
int TEST_NAME(test_circshift)() { ltfatInt L[] = {111, 1, 100}; ltfatInt shift[] = { -5, 0, 1, -1000, 10540, 5660}; for (unsigned int lId = 0; lId < ARRAYLEN(L); lId++) { LTFAT_TYPE* fin = LTFAT_NAME(malloc)(L[lId]); TEST_NAME(fillRand)(fin, L[lId]); LTFAT_TYPE* fout = LTFAT_NAME(malloc)(L[lId]); TEST_NAME(fillRand)(fout, L[lId]); for (unsigned int shiftId = 0; shiftId < ARRAYLEN(shift); shiftId++) { mu_assert( LTFAT_NAME(circshift)(fin, L[lId], shift[shiftId], fout) == 0, "circshift"); mu_assert( LTFAT_NAME(circshift)(fin, L[lId], shift[shiftId], fin) == 0, "circshift inplace"); } ltfat_free(fin); ltfat_free(fout); } LTFAT_TYPE* fin = LTFAT_NAME(malloc)(L[0]); TEST_NAME(fillRand)(fin, L[0]); LTFAT_TYPE* fout = LTFAT_NAME(malloc)(L[0]); TEST_NAME(fillRand)(fout, L[0]); // Inputs can be checked only once mu_assert( LTFAT_NAME(circshift)(NULL, L[0], shift[0], fin) == LTFATERR_NULLPOINTER, "First is null"); mu_assert( LTFAT_NAME(circshift)(fin, L[0], shift[0], NULL) == LTFATERR_NULLPOINTER, "Last is null"); mu_assert( LTFAT_NAME(circshift)(fin, 0, shift[0], fout) == LTFATERR_BADSIZE, "Zero length"); mu_assert( LTFAT_NAME(circshift)(fin, -1, shift[0], fout) == LTFATERR_BADSIZE, "Negative length"); mu_assert( LTFAT_NAME(circshift)(NULL, -1, shift[0], fout) < LTFATERR_SUCCESS, "Multiple wrong inputs"); ltfat_free(fin); ltfat_free(fout); return 0; }
int main(int argc, char *argv[]) { TEST_NAME(); auto luaScript = LuaScript(); luaScript.loadString("print('hello world!')"); luaScript.loadScript("test.lua"); luaScript.setGlobal("PI", 3.14); auto PI_value = luaScript.getGlobal_float("PI"); TEST_EQUAL(PI_value, 3.14, "global - float"); luaScript.setGlobal("numChildren", 3); auto numChildren = luaScript.getGlobal_int("numChildren"); TEST_EQUAL(numChildren, 3, "global - int"); luaScript.setGlobal("FirstName", "Benjamin Zaporzan"); auto firstName = luaScript.getGlobal_string("FirstName"); TEST_EQUAL(firstName, "Benjamin Zaporzan", "global - string"); auto floatValues = floatArrayType {1.1, 2.2, 3.3}; luaScript.setGlobal("Position", floatValues); luaScript.loadString("for i,v in ipairs(Position) do print(i,v) end"); auto floatValues2 = luaScript.getGlobal_floatArray("Position"); TEST_EQUAL(floatValues, floatValues2, "global - float array"); for (auto i : floatValues2) { std::cout << i << std::endl; } auto intValues = intArrayType { 1, 2, 3 }; luaScript.setGlobal("oneTwoThree", intValues); luaScript.loadString("for i,v in ipairs(oneTwoThree) do print(i,v) end"); auto intValues2 = luaScript.getGlobal_intArray("oneTwoThree"); TEST_EQUAL(intValues, intValues2, "global - int array"); return 0; }
int main(int argc, char *argv[]) { TEST_NAME(); auto q1 = Quaternion(1,2,3,0); auto q2 = Quaternion(1,1,1,1); auto q3 = q1 + q2; TEST_EQUAL(q3, Quaternion(2,3,4,1), "quaternion addition"); std::cout << "q1: " << q1 << std::endl; std::cout << "q2: " << q2 << std::endl; std::cout << "q1 * q2 = " << q1 * q2 << std::endl; TEST_EQUAL(q1*q2, 6.0, "scalar multiplication"); std::cout << "q1 x q2 = " << q1 % q2 << std::endl; TEST_EQUAL(q1%q2, Quaternion(-4,6,2,0), "product multiplication"); TEST_EQUAL(q1.conj(), Quaternion(1,-2,-3,0), "Conjugate"); TEST_EQUAL(q2.magnitude_real(), 2, "Real Magnitude"); TEST_EQUAL(q2.magnitude(), 4, "Magnitude"); auto q4 = Quaternion(5,3,2,2); std::cout << "q4-unit: " << q4.unit() << std::endl; std::cout << "q4-inverse: " << q4.inv() << std::endl; auto q5 = Quaternion(4,5,1,2); auto q6 = q5 % q1; q5 %= q1; TEST_EQUAL(q5, q6, "testing product2"); auto q7 = Quaternion(); q7[0] = 1; q7[1] = 2; q7[2] = q7[0] + q7[1]; q7[3] = q7[0] + q7[2]; std::cout << "q7: " << q7 << std::endl; TEST_EQUAL(q7, Quaternion(1,2,3,4), "testing assignment"); return 0; }
int main(int argc, char *argv[]) { TEST_NAME(); auto entityManager = EntityManager::getInstance(); auto entity = new AbstractEntity("Some Entity", 10); entityManager->addEntity(entity); TEST_EQUAL(entityManager->getEntityByID(10), entity, "getEntityByID()"); TEST_EQUAL(entityManager->getEntities().size(), 1, "getEntities()"); return 0; }
int TEST_NAME(test_pgauss)() { ltfatInt L[] = { 111, 1, 100 }; double w[] = { 0.001, 0.1, 0.2 }; double c_t[] = { 0.0, 0.1, -0.2 }; double c_f[] = { 0.0, 0.1, -0.2 }; for (unsigned int lId = 0; lId < ARRAYLEN(L); lId++) { LTFAT_TYPE* fin = LTFAT_NAME(malloc)(L[lId]); TEST_NAME(fillRand)(fin, L[lId]); LTFAT_COMPLEX* fincmplx = LTFAT_NAME_COMPLEX(malloc)(L[0]); TEST_NAME_COMPLEX(fillRand)(fincmplx, L[0]); for (unsigned int wId = 0; wId < ARRAYLEN(w); wId++) { for (unsigned int ctId = 0; ctId < ARRAYLEN(c_t); ctId++) { mu_assert( LTFAT_NAME(pgauss)( L[lId], w[wId], c_t[ctId], fin) == LTFATERR_SUCCESS, "pgauss"); for (unsigned int cfId = 0; cfId < ARRAYLEN(c_f); cfId++) { mu_assert( LTFAT_NAME(pgauss_cmplx)( L[lId], w[wId], c_t[ctId], c_f[cfId], fincmplx) == LTFATERR_SUCCESS, "pgauss"); } } } ltfat_free(fin); ltfat_free(fincmplx); } LTFAT_TYPE* fin = LTFAT_NAME(malloc)(L[0]); TEST_NAME(fillRand)(fin, L[0]); LTFAT_COMPLEX* fincmplx = LTFAT_NAME_COMPLEX(malloc)(L[0]); TEST_NAME_COMPLEX(fillRand)(fincmplx, L[0]); mu_assert( LTFAT_NAME(pgauss)( L[0], w[0], c_t[0], NULL) == LTFATERR_NULLPOINTER, "pgauss Array is null"); mu_assert( LTFAT_NAME(pgauss)( 0, w[0], c_t[0], fin) == LTFATERR_BADSIZE, "pgauss L is wrong"); mu_assert( LTFAT_NAME(pgauss)( L[0], 0.0, c_t[0], fin) == LTFATERR_NOTPOSARG, "pgauss Wrong t-f ratio"); mu_assert( LTFAT_NAME(pgauss_cmplx)( L[0], w[0], c_t[0], c_f[0], NULL) == LTFATERR_NULLPOINTER, "pgauss cmplx Array is null"); mu_assert( LTFAT_NAME(pgauss_cmplx)( 0, w[0], c_t[0], c_f[0], fincmplx) == LTFATERR_BADSIZE, "pgauss cmplx L is wrong"); mu_assert( LTFAT_NAME(pgauss_cmplx)( L[0], 0.0, c_t[0], c_f[0], fincmplx) == LTFATERR_NOTPOSARG, "pgauss cmplx Wrong t-f ratio"); ltfat_free(fin); ltfat_free(fincmplx); return 0; }
/* * This is the default test directory for the TP 40x/35x board */ static TEST_ITEM asTestDirectory[] = { /* Test number, * Test duration (mS), * Test permissions: PBIT | LBIT | RBIT | CBIT, * root name */ { 1, 20, BITF__PBIT_TEST | BITF__LBIT | BITF__RBIT | BITF__CBIT, TEST_NAME (PassingTest) }, { 2, 20, BITF__PBIT_TEST | BITF__LBIT | BITF__RBIT | BITF__CBIT, TEST_NAME (FailingTest) }, { 10, 20, BITF__PBIT_10S | BITF__LBIT | BITF__RBIT | BITF__CBIT | BITF__CUTE, TEST_NAME (CPUExec) },