int main (int argc, char **argv) { DBusError error; DBusConnection *connection; dbus_error_init (&error); connection = dbus_bus_get (DBUS_BUS_SESSION, &error); if (connection == NULL) { fprintf (stderr, "*** Failed to open connection to system bus: %s\n", error.message); dbus_error_free (&error); return 1; } loop = _dbus_loop_new (); if (loop == NULL) die ("No memory\n"); if (!test_connection_setup (loop, connection)) die ("No memory\n"); TestName(connection, "org.freedesktop.DBus.Test", TRUE); TestName(connection, "org.freedesktop.DBus.Test-2", TRUE); TestName(connection, "org.freedesktop.DBus.Test_2", TRUE); #if 0 TestName(connection, "Test_2", TRUE); #endif _dbus_verbose ("*** Test service name exiting\n"); return 0; }
void TestFCONameTranslator() { TestName( _T("/not_quoted/tmp"), _T("FS") ); TestName( _T("/\"quoted\"/tmp"), _T("FS") ); TestName( _T("/tmp/\"freak\x08y\""), _T("FS") ); TestUnprintable( _T("c:\\\"more freak\xFFy\""), _T("FS") ); }
int main () { DBusError error; DBusConnection *connection; //_dbus_setenv("DBUS_VERBOSE","1"); dbus_error_init (&error); connection = dbus_bus_get (DBUS_BUS_SESSION, &error); if (connection == NULL) { fprintf (stderr, "*** Failed to open connection to system bus: %s\n", error.message); std_log(LOG_FILENAME_LINE, "*** Failed to open connection to system bus: %s\n", error.message); dbus_error_free (&error); create_xml(1); return 1; } /*con2 = dbus_bus_get_private (DBUS_BUS_SESSION, &error); if (con2 == NULL) { fprintf (stderr, "*** Failed to open connection to system bus: %s\n", error.message); dbus_error_free (&error); return 1; } */ /* loop = _dbus_loop_new (); if (loop == NULL) die ("No memory\n"); if (!test_connection_setup (loop, connection)) die ("No memory\n"); */ TestName(connection, "org.freedesktop.DBus.Test", TRUE); TestName(connection, "org.freedesktop.DBus.Test-2", TRUE); TestName(connection, "org.freedesktop.DBus.Test_2", TRUE); #if 0 TestName(connection, "Test_2", TRUE); #endif //ch=getchar(); _dbus_verbose ("*** Test service name exiting\n"); create_xml(0); return 0; }
Test createTest (const std::string& strVal) { return Test ( ConstructorFailTest<int> (strVal), TestName ("'" + strVal + "'") ); }
void RunTestExToNulBuf(const TextBuf &input, const TextBuf &expected, size_t bufsize, ib_status_t expected_rc) { char buf[bufsize]; size_t len; ib_status_t rc; ib_flags_t result; rc = ExecExToNulBuf(input.GetUBuf(), input.GetLen(), buf, bufsize, len, result); if (rc == IB_ENOTIMPL) { return; } const char *name = TestName(IB_STROP_BUF, TYPE_EX_TO_STR); ASSERT_EQ(expected_rc, rc) << name; TextBuf output(buf); CheckResult(name, input, expected, IB_STRFLAG_NONE, IB_STRFLAG_MODIFIED, rc, result, output); }
void TestBiblioName(docLanguage language) { const char* name = NameByLanguage(language); UNIT_ASSERT(name != NULL); UNIT_ASSERT(strlen(name) > 2); TestName(language, name); }
void TestFullName(docLanguage language) { const char* name = FullNameByLanguage(language); UNIT_ASSERT(name != NULL); UNIT_ASSERT(strlen(name) == 0 || strlen(name) > 3); if (strlen(name)) TestName(language, name); }
constexpr Test createTest ( const T floatVal, const std::string& testName ) { return Test ( ConstructorFailTest<T> (floatVal), TestName (testName) ); }
void TestIsoName(docLanguage language) { const char* name = IsoNameByLanguage(language); UNIT_ASSERT(name != NULL); UNIT_ASSERT(strlen(name) == 0 || strlen(name) == 2 || !strcmp(name, "mis") || !strncmp(name, "bas-", 4)); if (strlen(name)) TestName(language, name); }
FString UTimelineTemplate::MakeUniqueCurveName(UObject* Obj, UObject* InOuter) { FString OriginalName = Obj->GetName(); FName TestName(*OriginalName); while(StaticFindObjectFast(NULL, InOuter, TestName)) { TestName = FName(*OriginalName, TestName.GetNumber()+1); } return TestName.ToString(); }
FString UTimelineTemplate::MakeUniqueCurveName(UObject* Obj) { FString OriginalName = Obj->GetName(); UClass* Class = Obj->GetClass(); UObject* Outer = Obj->GetOuter(); FName TestName(*OriginalName); while(StaticFindObjectFast(Class, Outer, TestName)) { TestName = FName(*OriginalName, TestName.GetNumber()+1); } return TestName.ToString(); }
constexpr Test createTest ( const T intVal, const uint64_t fracVal, const uint8_t dp, const Number::Sign sign, const std::string& testName ) { return Test ( ConstructorFailTest<T> (intVal, fracVal, dp, sign), TestName (testName) ); }
int main() { auto names = ReadNames("dist.female.first"); std::vector<std::string> tests; tests.push_back("LINDA"); tests.push_back("PETER"); tests.push_back("DOROTHY"); for(auto test : tests) { std::cout << test << " " << TestName(names, test) << std::endl; } return 0; }
HRESULT ViewTest1::Run() { m_qxvoTest.CreateInstance(CLSID_VwOverlay); TestName(); TestGuid(); TestVwOverlayFlags(); TestFontName(); TestFontSize(); TestMaxShowTags(); TestCTags(); TestSetTagInfo(); TestGetDbTagInfo(); TestGetDlgTagInfo(); TestGetDispTagInfo(); TestSort(); TestMerge(); return S_OK; }
void RunTestCopyNul(const TextBuf &input, const TextBuf &expected) { char *out; ib_status_t rc; ib_flags_t result; rc = ExecCopyNul(input.GetStr(), &out, result); if (rc == IB_ENOTIMPL) { return; } const char *name = TestName(IB_STROP_COPY, TYPE_NUL); ASSERT_EQ(IB_OK, rc) << name; TextBuf output(out); CheckResult(name, input, expected, IB_STRFLAG_NEWBUF, (IB_STRFLAG_NEWBUF | IB_STRFLAG_MODIFIED), rc, result, output); }
void RunTestCopyEx(const TextBuf &input, const TextBuf &expected) { size_t len = input.GetLen(); uint8_t *out; ib_status_t rc; size_t outlen; ib_flags_t result; rc = ExecCopyEx(input.GetUBuf(), len, &out, outlen, result); if (rc == IB_ENOTIMPL) { return; } const char *name = TestName(IB_STROP_COPY, TYPE_EX); ASSERT_EQ(IB_OK, rc) << name; TextBuf output(out, outlen); CheckResult(name, input, expected, IB_STRFLAG_NEWBUF, (IB_STRFLAG_NEWBUF | IB_STRFLAG_MODIFIED), rc, result, output); }
constexpr Test createTest ( const T floatVal, unsigned int dp, unsigned int expectedDp, uint64_t expectedIntVal, uint64_t expectedFracVal, const std::string& expectedStrVal, const bool expectedVal64Set ) { return Test ( ConstructorTest<T> ( floatVal, dp, expectedDp, expectedIntVal, expectedFracVal, expectedStrVal, expectedVal64Set ), TestName (expectedStrVal) ); }
void RunTestInplaceNul(const TextBuf &input, const TextBuf &expected) { size_t len = input.GetLen(); char buf[len]; ib_status_t rc; ib_flags_t result; strcpy(buf, input.GetStr()); rc = ExecInplaceNul(buf, result); if (rc == IB_ENOTIMPL) { return; } const char *name = TestName(IB_STROP_INPLACE, TYPE_NUL); ASSERT_EQ(IB_OK, rc) << name; TextBuf output(buf); CheckResult(name, input, expected, IB_STRFLAG_ALIAS, (IB_STRFLAG_ALIAS | IB_STRFLAG_MODIFIED), rc, result, output); }
static void CheckFetch(const char *c1name, const char *c1, const char *c2) { int error = 0; TestName(1, c1name); CHKFetch("S"); if (strlen(c1) != ind1 || strcmp(c1, col1) != 0) { fprintf(stderr, "%s:%d: Column 1 error '%s' (%d) expected '%s' (%d)\n", __FILE__, main_line, col1, (int) ind1, c1, (int) strlen(c1)); error = 1; } if (strlen(c2) != ind2 || strcmp(c2, col2) != 0) { fprintf(stderr, "%s:%d: Column 2 error '%s' (%d) expected '%s' (%d)\n", __FILE__, main_line, col2, (int) ind2, c2, (int) strlen(c2)); error = 1; } if (error) exit(1); }
void RunTestInplaceEx(const TextBuf &input, const TextBuf &expected) { size_t len = input.GetLen(); uint8_t buf[len]; ib_status_t rc; size_t outlen; ib_flags_t result; memcpy(buf, input.GetBuf(), len); rc = ExecInplaceEx(buf, len, outlen, result); if (rc == IB_ENOTIMPL) { return; } const char *name = TestName(IB_STROP_INPLACE, TYPE_EX); ASSERT_EQ(IB_OK, rc) << name; TextBuf output(buf, outlen); CheckResult(name, input, expected, IB_STRFLAG_ALIAS, (IB_STRFLAG_ALIAS | IB_STRFLAG_MODIFIED), rc, result, output); }
void COomFailBase::ConstructL() { iTest->INFO_PRINTF1(TestName()); }
namespace test { template < typename T, unsigned int MAX_ITERATIONS, int startVal = 1, typename FBS > bool run_test (FBS fbs) { T curVal = 0; for (unsigned int i = 0; i < MAX_ITERATIONS; ++i) { unsigned int got1 = fbs (curVal); unsigned int got2 = curVal > 0 ? fbs (curVal | 0x1) : got1; unsigned int got3 = curVal > 0 ? fbs (curVal | (curVal - 1)) : got1; if ((got1 != i) || (got2 != i) || (got3 != i)) { std::cerr << "Expected: " << static_cast<int> (i) << " got1: " << static_cast<int> (got1) << " got2: " << static_cast<int> (got2) << " got3: " << static_cast<int> (got3) << std::endl; return false; } curVal = curVal ? curVal * 2 : startVal; } return true; } template < typename T, unsigned int MAX_ITERATIONS, int startVal = 1 > bool testNonConstExpr () { return run_test< T, MAX_ITERATIONS, startVal, FirstBitSet > (FirstBitSet ()); } template < typename T, unsigned int MAX_ITERATIONS, int startVal = 1 > bool testConstExpr () { auto fbs = static_cast<unsigned int (*) (T)> ( &FirstBitSet::findConstExpr ); return run_test<T, MAX_ITERATIONS, startVal, decltype (fbs)> (fbs); } std::vector<Test> NumberFirstBitSetTestVec = { {testNonConstExpr<int32_t, 32>, TestName ("testNonCE<int32_t>")}, {testNonConstExpr<int32_t, 33, -1>, TestName ("testNonCE<int32_t, -1>")}, {testNonConstExpr<uint32_t, 33>, TestName ("testNonCE<uint32_t>")}, {testNonConstExpr<int64_t, 64>, TestName ("testNonCE<int64_t>")}, {testNonConstExpr<int64_t, 65, -1>, TestName ("testNonCE<int64_t, -1>")}, {testNonConstExpr<uint64_t, 65>, TestName ("testNonCE<uint64_t>")}, {testNonConstExpr<__int128_t, 128>, TestName ("testNonCE<int128_t>")}, { testNonConstExpr<__int128_t, 129, -1>, TestName ("testNonCE<int128_t, -1>") }, {testNonConstExpr<__uint128_t, 129>, TestName ("testNonCE<uint128_t>")}, {testConstExpr<int64_t, 64>, TestName ("testConstExpr<int64_t>")}, {testConstExpr<int64_t, 65, -1>, TestName ("testConstExpr<int64_t, -1>")} }; } // namespace test
static void DoTest(int version3) { char name[128], params[128]; SQLSMALLINT type, is_unsigned; SQLINTEGER col_size, min_scale; SQLLEN ind1, ind2, ind3, ind4, ind5, ind6; int date_time_supported = 0; int name_version3; odbc_use_version3 = version3; name_version3 = version3; odbc_connect(); printf("Using ODBC version %d\n", version3 ? 3 : 2); /* test column name */ /* MS ODBC use always ODBC 3 names even in ODBC 2 mode */ if (!odbc_driver_is_freetds()) name_version3 = 1; CHKGetTypeInfo(SQL_ALL_TYPES, "SI"); TestName(1, "TYPE_NAME"); TestName(2, "DATA_TYPE"); TestName(3, name_version3 ? "COLUMN_SIZE" : "PRECISION"); TestName(4, "LITERAL_PREFIX"); TestName(5, "LITERAL_SUFFIX"); TestName(6, "CREATE_PARAMS"); TestName(7, "NULLABLE"); TestName(8, "CASE_SENSITIVE"); TestName(9, "SEARCHABLE"); TestName(10, "UNSIGNED_ATTRIBUTE"); TestName(11, name_version3 ? "FIXED_PREC_SCALE" : "MONEY"); TestName(12, name_version3 ? "AUTO_UNIQUE_VALUE" : "AUTO_INCREMENT"); TestName(13, "LOCAL_TYPE_NAME"); TestName(14, "MINIMUM_SCALE"); TestName(15, "MAXIMUM_SCALE"); /* TODO test these column for ODBC 3 */ /* ODBC 3.0 SQL_DATA_TYPE SQL_DATETIME_SUB NUM_PREC_RADIX INTERVAL_PRECISION */ Flushodbc_stmt(); /* TODO test if SQL_ALL_TYPES returns right numeric type for timestamp */ /* numeric type for data */ /* test for date/time support */ if (odbc_command_with_result(odbc_stmt, "select cast(getdate() as date)") == SQL_SUCCESS) date_time_supported = 1; SQLCloseCursor(odbc_stmt); #define CHECK_TYPE(in,out) CheckType(in, out, #in, __LINE__) /* under Sybase this type require extra handling, check it */ CHECK_TYPE(SQL_VARCHAR, SQL_VARCHAR); CHECK_TYPE(SQL_DATE, date_time_supported && !version3 ? SQL_DATE : SQL_UNKNOWN_TYPE); CHECK_TYPE(SQL_TIME, date_time_supported && !version3 ? SQL_TIME : SQL_UNKNOWN_TYPE); /* MS ODBC returns S1004 (HY004), TODO support it */ if (odbc_driver_is_freetds() || version3) { CHECK_TYPE(SQL_TYPE_DATE, date_time_supported && version3 ? SQL_TYPE_DATE : SQL_UNKNOWN_TYPE); CHECK_TYPE(SQL_TYPE_TIME, date_time_supported && version3 ? SQL_TYPE_TIME : SQL_UNKNOWN_TYPE); } /* TODO MS ODBC handle SQL_TIMESTAMP even for ODBC 3 */ if (odbc_driver_is_freetds()) CHECK_TYPE(SQL_TIMESTAMP, version3 ? SQL_UNKNOWN_TYPE : SQL_TIMESTAMP); else CHECK_TYPE(SQL_TIMESTAMP, version3 ? SQL_TYPE_TIMESTAMP : SQL_TIMESTAMP); /* MS ODBC returns S1004 (HY004), TODO support it */ if (odbc_driver_is_freetds() || version3) { CHECK_TYPE(SQL_TYPE_TIMESTAMP, version3 ? SQL_TYPE_TIMESTAMP : SQL_UNKNOWN_TYPE); } /* TODO implement this part of test */ /* varchar/nvarchar before sysname */ /* test binding (not all column, required for Oracle) */ CHKGetTypeInfo(SQL_ALL_TYPES, "SI"); CHKBindCol(1, SQL_C_CHAR, name, sizeof(name), &ind1, "SI"); CHKBindCol(2, SQL_C_SSHORT, &type, 0, &ind2, "SI"); CHKBindCol(3, SQL_C_SLONG, &col_size, 0, &ind3, "SI"); CHKBindCol(6, SQL_C_CHAR, params, sizeof(params), &ind4, "SI"); CHKBindCol(10, SQL_C_SSHORT, &is_unsigned, 0, &ind5, "SI"); CHKBindCol(14, SQL_C_SSHORT, &min_scale, 0, &ind6, "SI"); while (CHKFetch("SNo") == SQL_SUCCESS) ; SQLFreeStmt(odbc_stmt, SQL_UNBIND); Flushodbc_stmt(); /* check WVARCHAR for no pending data */ if (odbc_db_is_microsoft() || strncmp(odbc_db_version(), "15.00.", 6) >= 0) { CHKGetTypeInfo(SQL_WVARCHAR, "SI"); CHKFetch("S"); if (odbc_db_is_microsoft()) CHKFetch("S"); CHKFetch("No"); CHKGetTypeInfo(SQL_BINARY, "SI"); } odbc_disconnect(); }