Exemple #1
0
 void run() {
     // expected count would be 99 but we delete the second record
     // after doing the first unit of work
     CountRequest request = createCountRequest(BSON("x" << GTE << 1));
     testCount(request, kDocuments-2);
     testCount(request, kDocuments-2, true);
 }
Exemple #2
0
 void run() {
     // expected count would be kDocuments-2 but we update the first and second records
     // after doing the first unit of work so they wind up getting counted later on
     CountRequest request = createCountRequest(BSON("x" << GTE << 2));
     testCount(request, kDocuments);
     testCount(request, kDocuments, true);
 }
Exemple #3
0
/**
 * @brief Main program for testextra.
 */
int main(int argc, char const * const * argv)
{
    int verbosity = 0;
    if (argc == 2) {
        int nread;
        int ret = sscanf(argv[1], "%d%n", &verbosity, &nread);
        if (ret != 1 || argv[1][nread]) {
            fprintf(stderr, "Usage: %s [verbosity]\n", argv[0]);
            return -1;
        }
    }
    if (testBdd(verbosity) != 0)
        return -1;
    if (testAdd(verbosity) != 0)
        return -1;
    if (testZdd(verbosity) != 0)
        return -1;
    if (testApa(verbosity) != 0)
        return -1;
    if (testCount(verbosity) != 0)
        return -1;
    if (testLdbl(verbosity) != 0)
        return -1;
    if (testTimeout(verbosity) != 0)
        return -1;
    return 0;
}
Exemple #4
0
bool Runner::runAllTest(bool printSummary) const {
  unsigned int count = testCount();
  std::deque<TestResult> failures;
  for (unsigned int index = 0; index < count; ++index) {
    TestResult result;
    runTestAt(index, result);
    if (result.failed()) {
      failures.push_back(result);
    }
  }

  if (failures.empty()) {
    if (printSummary) {
      printf("All %d tests passed\n", count);
    }
    return true;
  } else {
    for (unsigned int index = 0; index < failures.size(); ++index) {
      TestResult& result = failures[index];
      result.printFailure(count > 1);
    }

    if (printSummary) {
      unsigned int failedCount = static_cast<unsigned int>(failures.size());
      unsigned int passedCount = count - failedCount;
      printf("%d/%d tests passed (%d failure(s))\n",
             passedCount,
             count,
             failedCount);
    }
    return false;
  }
}
Exemple #5
0
	int TestSuite::runAllTest(const char *file)
	{
		///@TODO testList를 이름순으로 적절히 정렬하기

		StopWatch stopwatch;
		stopwatch.start();

		if(file != NULL)
		{
			LOG("Running main() from %s", file);
		}
		LOG("[==========] Running %d tests from %d test case.", testCount(), testcaseCount());
		LINE_LOG("[----------] Global test environment set-up.");

		//테스트 케이스로 등록한거 처리
		TestListType::iterator it = testList_.begin();
		TestListType::iterator endit = testList_.end();
		for( ; it != endit ; it++)
		{
			Test* test = *it;
			test->__run();
		}

		stopwatch.stop();
		int ms = stopwatch.getTimeMillisecond();

		LINE_LOG("[----------] Global test environment tear-down");

		//fail도 받아서 여기에서 보여줘야됨
		LOG("[==========] %d tests from %d test case ran. (%d ms total)", testCount(), testcaseCount(), ms);
		LOG("[  PASSED  ] %d test.", passCount());

		vector<Test*> failList = getFailList();
		if(failList.size() > 0)
		{
			LOG("[  FAILED  ] %d test, listed below:", (int)failList.size());
			vector<Test*>::iterator failIter;
			for(failIter = failList.begin() ; failIter != failList.end() ; failIter++)
			{
				Test* test = *failIter;
				LOG("[  FAILED  ] %s.%s", test->name(), test->method());
			}
		}
		return 0;
	}
void 
Runner::listTests() const
{
   unsigned int count = testCount();
   for ( unsigned int index = 0; index < count; ++index )
   {
      printf( "%s\n", testNameAt( index ).c_str() );
   }
}
Exemple #7
0
static void
testCounts (adtree_t* adtreePtr, data_t* dataPtr)
{
    long numVar = dataPtr->numVar;
    vector_t* queryVectorPtr = vector_alloc(numVar);
    long v;
    for (v = -1; v < numVar; v++) {
        testCount(adtreePtr, dataPtr, queryVectorPtr, v, dataPtr->numVar);
    }
    vector_free(queryVectorPtr);
}
Exemple #8
0
bool Runner::testIndex(const std::string& testName,
                       unsigned int& indexOut) const {
  unsigned int count = testCount();
  for (unsigned int index = 0; index < count; ++index) {
    if (testNameAt(index) == testName) {
      indexOut = index;
      return true;
    }
  }
  return false;
}
Exemple #9
0
static void
testCount (adtree_t* adtreePtr,
           data_t* dataPtr,
           vector_t* queryVectorPtr,
           long index,
           long numVar)
{
    if (index >= numVar) {
        return;
    }

    long count1 = adtree_getCount(adtreePtr, queryVectorPtr);
    long count2 = countData(dataPtr, queryVectorPtr);
    if (global_doPrint) {
        printQuery(queryVectorPtr);
        printf(" count1=%li count2=%li\n", count1, count2);
        fflush(stdout);
    }
    assert(count1 == count2);

    query_t query;

    long i;
    for (i = 1; i < numVar; i++) {
        query.index = index + i;
        bool_t status = vector_pushBack(queryVectorPtr, (void*)&query);
        assert(status);

        query.value = 0;
        testCount(adtreePtr, dataPtr, queryVectorPtr, query.index, numVar);

        query.value = 1;
        testCount(adtreePtr, dataPtr, queryVectorPtr, query.index, numVar);

        vector_popBack(queryVectorPtr);
    }
}
void CDummyCalendarApp::DoTestL()
	{
	TInt testCount(0);
	
	while (testCount < CTestData::ENumberOfTestsForFixedAndFloating)
		{
		OpenCleanFileL();
		FillDefaultDatabaseL(testCount, EFalse);
		ExtractFromDatabaseL();
		testCount++;
		iTestLib->CleanDatabaseL();
		}

	// repeat the above test for floating entry
	/**
	@SYMTestCaseID PIM-TCAL-GSENTRY-Floating_Parent_And_Child_Entry-0001
	@SYMTestCaseDesc Create floating parent and child entries
	@SYMFssID App-Engines/CalInterimAPI/Data.007
	@SYMTestStatus Implemented
	@SYMTestPriority Medium
	@SYMTestActions Create floating parent and child entries with various combination of repeating rule, excption dates, and RDates. 
	Store the entries, then check that the expected instances can be retrieved.
	@SYMTestExpectedResults The check shows that the instances defined by the repeated rule and exception dates and RDates are found
	@SYMTestType CT	
	*/
	testCount = 0;
	while (testCount < CTestData::ENumberOfTests)
		{
		OpenCleanFileL();
		FillDefaultDatabaseL(testCount, ETrue);
		ExtractFromDatabaseL();
		testCount++;
		iTestLib->CleanDatabaseL();
		}

    //Test with Local floating time the replacement of existing child entry
    OpenCleanFileL();
    //Fill the database with entries in LocalFloating format and with August dates
    //to get difference between UTC and Local time
    FillDefaultDatabaseL(CTestData::EReplaceExistingChild, ETrue, ETrue);
    ExtractEntriesL(ETrue, 3);//check the entries count, it should be 3

	//Test added for DEF069038
	ExtractNonExistentEntryL();
	}
DataProcessor::DataProcessor(QObject *parent) : QObject(parent)
{
	/*实例初始化*/
    database = new Database(this);//数据库实例
	ammeter = new Ammeter(this);//电表实例
	regulator  = new Regulator(this);//下位机实例
    saveDataTimer = new QTimer(this);//存储数据计时器
    monitorTimer = new QTimer(this);//电表监控计时器
    /*参数初始化*/
    ProporitonLimit       = PROPORTIONDEFAULT;
    AveragePower          = 0.0;
    TotalPower            = 0.0;
    GetDataTimeInterval   = GETDATATIMEDEFAULT;
    SaveDataTimeInterval  = SAVEDATATIMEDEFALT;
    MonitorTimeInterval   = MONITORTIMEDEFALT;
    /*读取数据*/
    QObject::connect(ammeter,SIGNAL(getDataOver()),this,SLOT(getData()));
    QObject::connect(ammeter,SIGNAL(ammeterError()),this,SLOT(ammeterGetDataError()));
    QObject::connect(ammeter,SIGNAL(ammeterNotFound()),this,SLOT(ammeterGetDataError()));
    if(ammeter->isAmmeterFound())AmmeterError=false;
    if(!ammeter->isAmmeterFound())ammeterGetDataError();
    if(regulator->isRegulatorFound())RegulatorError=false;
    if(!regulator->isRegulatorFound())regulatorConnectError();
    /*存储数据*/
    QObject::connect(saveDataTimer,SIGNAL(timeout()),this,SLOT(saveData()));
    saveDataTimer->start(SaveDataTimeInterval*1000);//默认10s一次
    /*监控一次*/
    QObject::connect(monitorTimer,SIGNAL(timeout()),this,SLOT(monitorAction()));
    monitorTimer->start(MonitorTimeInterval*1000);//默认600s一次
   /*regulator 软关机开始,节电测试开始*/
    QObject::connect(regulator,SIGNAL(shutDownBack()),this,SLOT(testStart()));
    QObject::connect(regulator,SIGNAL(shutDownOver()),this,SLOT(testCount()));
    QObject::connect(regulator,SIGNAL(regulatorError()),this,SLOT(regulatorConnectError()));


}
Exemple #12
0
void 
MostRecentTests::selectTestToRun( int index )
{
  if ( index < testCount() )
    setTestToRun( testAt( index ) );
}
Exemple #13
0
 void run() {
     CountRequest request = createCountRequest(BSON("x" << GTE << 0), 2);
     testCount(request, kDocuments-2);
     testCount(request, kDocuments-2, true);
 }
Exemple #14
0
 void run() {
     CountRequest request = createCountRequest(BSON("x" << GTE << 0), 0, 2);
     testCount(request, 2);
     testCount(request, 2, true);
 }
 static void test() {
   testCount();
   testIsBufferEmptyOrFull();
   testEmptyAfterDone();
 }
  static void testCount() {
    int buffer_length = BufferingOopClosure::BufferLength;

    for (int order = 0; order < FakeRoots::MaxOrder; order++) {
      testCount(0,                 0,                 order);
      testCount(10,                0,                 order);
      testCount(0,                 10,                order);
      testCount(10,                10,                order);
      testCount(buffer_length,     10,                order);
      testCount(10,                buffer_length,     order);
      testCount(buffer_length,     buffer_length,     order);
      testCount(buffer_length + 1, 10,                order);
      testCount(10,                buffer_length + 1, order);
      testCount(buffer_length + 1, buffer_length,     order);
      testCount(buffer_length,     buffer_length + 1, order);
      testCount(buffer_length + 1, buffer_length + 1, order);
    }
  }
Exemple #17
0
 void run() {
     CountRequest request = createCountRequest(BSON("x" << 1));
     testCount(request, kInterjections+1);
     testCount(request, kInterjections+1, true);
 }
Exemple #18
0
 void run() {
     CountRequest request = createCountRequest(BSON("x" << 1));
     testCount(request, kDocuments+1, true); // only applies to indexed case
 }
Exemple #19
0
 void run() {
     BSONObj filter = BSON("x" << LT << kDocuments/2);
     CountRequest request = createCountRequest(filter);
     testCount(request, kDocuments/2);
     testCount(request, kDocuments/2, true);
 }