当前位置: 首页>>代码示例>>C++>>正文


C++ TestData类代码示例

本文整理汇总了C++中TestData的典型用法代码示例。如果您正苦于以下问题:C++ TestData类的具体用法?C++ TestData怎么用?C++ TestData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TestData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Run

    virtual int Run()
    {
        LogText("LocklessTest::Producer::Run started.\n");        

        for (int testVal = 0; testVal < TestIterations; testVal++)
        {
            TestData d;
            d.Set(testVal);

            {
                //Lock::Locker scope(&TestLock);
                TestDataUpdater.SetState(d);
            }

            FirstItemWritten = true;

            // Spin a bit
            for(int j = 0; j < 1000; j++)
            {
                Dummy2 = j;
            }

            if (testVal % (TestIterations/30) == 0)
            {
                LogText("LocklessTest::Producer - %5.2f%% done\n",
                        100.0f * (float)testVal/(float)TestIterations);
            }
        }

        LogText("LocklessTest::Producer::Run exiting.\n");
        return 0;
    }
开发者ID:Dean-Jansen,项目名称:GMOculus,代码行数:32,代码来源:OVR_Lockless.cpp

示例2: BOOST_TEST_MESSAGE

// Test GJRGARCH model calibration using DAX volatility data.
bool AdjointGjrgarchModelTest::testGJRGARCHmodel()
{
    BOOST_TEST_MESSAGE("Testing adjoint differentiation for GJRGARCH model calibration using DAX volatility data...");

    TestData testData;

    size_t n = 2;
    GJRGARCHmodelTest test(n, &testData);

    // Tape recording.
    cl::Independent(test.volatility_);
    test.calculateTotalError();
    cl::tape_function<double> f(test.volatility_, test.totalCalibrationErrorValue_);

    // Forward mode derivatives calculation.
    test.forwardResults_.resize(n);
    std::vector<double> dX(n, 0);
    for (size_t i = 0; i < n; i++)
    {
        dX[i] = 1;
        test.forwardResults_[i] = f.Forward(1, dX)[0];
        dX[i] = 0;
    }

    // Reverse mode derivatives calulation.
    test.reverseResults_ = f.Reverse(1, std::vector<double>(1, 1));

    test.calcAnalytical();

    return test.check() && testData.makeOutput();
}
开发者ID:ChinaQuants,项目名称:QuantLibAdjoint,代码行数:32,代码来源:adjointgjrgarchmodeltest.cpp

示例3: runIndexedTest

void DataDrivenCalendarTest::runIndexedTest(int32_t index, UBool exec,
        const char* &name, char* /*par */) {
    if (driver != NULL) {
        if (exec) {
            //  logln("Begin ");
        }
        const DataMap *info= NULL;
        UErrorCode status= U_ZERO_ERROR;
        TestData *testData = driver->createTestData(index, status);
        if (U_SUCCESS(status)) {
            name = testData->getName();
            if (testData->getInfo(info, status)) {
                log(info->getString("Description", status));
            }
            if (exec) {
                log(name);
                logln("---");
                logln("");

                processTest(testData);
            }
            delete testData;
        } else {
            name = "";
        }
    } else {
        dataerrln("format/DataDriven*Test data (calendar.res) not initialized!");
        name = "";
    }

}
开发者ID:Epictetus,项目名称:build-couchdb,代码行数:31,代码来源:dadrcal.cpp

示例4: test_vim_marks

void FakeVimPlugin::test_vim_marks()
{
    TestData data;
    setup(&data);

    data.setText("  abc" N "  def" N "  ghi");
    data.doKeys("ma");
    data.doKeys("ma");
    data.doKeys("jmb");
    data.doKeys("j^mc");
    KEYS("'a",   "  " X "abc" N   "  "   "def" N   "  "   "ghi");
    KEYS("`a", X "  "   "abc" N   "  "   "def" N   "  "   "ghi");
    KEYS("`b",   "  "   "abc" N X "  "   "def" N   "  "   "ghi");
    KEYS("'b",   "  "   "abc" N   "  " X "def" N   "  "   "ghi");
    KEYS("`c",   "  "   "abc" N   "  "   "def" N   "  " X "ghi");
    KEYS("'c",   "  "   "abc" N   "  "   "def" N   "  " X "ghi");

    KEYS("`b",   "  "   "abc" N X "  "   "def" N   "  "   "ghi");
    KEYS("'c",   "  "   "abc" N   "  "   "def" N   "  " X "ghi");

    KEYS("`'",   "  "   "abc" N X "  "   "def" N   "  "   "ghi");
    KEYS("`a", X "  "   "abc" N   "  "   "def" N   "  "   "ghi");
    KEYS("''",   "  "   "abc" N   "  " X "def" N   "  "   "ghi");
    KEYS("`'", X "  "   "abc" N   "  "   "def" N   "  "   "ghi");
    KEYS("`'",   "  "   "abc" N   "  " X "def" N   "  "   "ghi");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:26,代码来源:fakevim_test.cpp

示例5: Kss

	/**
	 * @brief	Self [co]variance matrix between the test data, Kss(Z, Z)
	 * @param	[in] logHyp 				The log hyperparameters
	 *												- logHyp(0) = \f$\log(l)\f$
	 *												- logHyp(1) = \f$\log(\sigma_f)\f$
	 * @param	[in] testData 				The test data
	 * @param	[in] fVarianceVector		Flag for the return value
	 * 											- fVarianceVector = true : return \f$\mathbf{k}_{**} \in \mathbb{R}^{M \times 1}, \mathbf{k}_{**}^i = k(\mathbf{Z}_i, \mathbf{Z}_i)\f$ (default)
	 *												- fVarianceVector = false: return \f$\mathbf{K}_{**} = \mathbf{K}(\mathbf{Z}, \mathbf{Z}) \in \mathbb{R}^{M \times M}\f$,\n
    *																					which can be used for Bayesian Committee Machines.
	 * @return	A matrix pointer\n
	 *				- Mx1 (fVarianceVector == true)
	 * 			- MxM (fVarianceVector == false)\n
	 * 			M: The number of test data
	 */
	static MatrixPtr Kss(const Hyp						&logHyp, 
								const TestData<Scalar>		&testData, 
								const bool						fVarianceVector = true)
	{
		// The number of test data
		const int M = testData.M();

		// Some constant values
		const Scalar sigma_f2 = exp(static_cast<Scalar>(2.0) * logHyp(1)); // sigma_f^2

		// Output
		MatrixPtr pKss;

		// K: self-variance vector (Mx1)
		if(fVarianceVector)
		{
			// k(z, z) = sigma_f^2
			pKss.reset(new Matrix(M, 1));
			pKss->fill(sigma_f2);
		}

		// K: self-covariance matrix (MxM)
		else					
		{
			// K(r)
			MatrixPtr pAbsDistXsXs = PairwiseOp<Scalar>::sqDist(testData.pXs()); // MxM
			pAbsDistXsXs->noalias() = pAbsDistXsXs->cwiseSqrt();	
			pKss = K(logHyp, pAbsDistXsXs);
		}

		return pKss;
	}
开发者ID:kanster,项目名称:OpenGP,代码行数:47,代码来源:CovMaterniso.hpp

示例6: OutputTestData

static void OutputTestData(const TestData &v)
{
	for (TestData::const_iterator i = v.begin(); i != v.end(); ++i)
	{
		cerr << i->first << ": " << i->second << endl;
	}
}
开发者ID:Kthulhu,项目名称:cryptopp,代码行数:7,代码来源:datatest.cpp

示例7: onRead

    virtual void onRead(TestData &datum)
    {
        if (count==nframes)
            return;


        double now=Time::now();
        double origT=datum.get();
        unsigned int pl=datum.getPayloadSize();


#ifdef USE_PARALLEL_PORT
        static ppEventDebugger pp(0x378);
        pp.set();
        pp.reset();
#endif

        TestData &nd=outPort.prepare();
        nd.set(origT);
        nd.resize(pl);
        outPort.write(true);

        if (wait<=0)
            {

                double dT=(now-origT)*1000;
                delay+=dT;
                delaySq+=(dT*dT);
                count++;

                latencies.push_back(Report(dT, pl));
            }
        else
            wait--;
    }
开发者ID:BRKMYR,项目名称:yarp,代码行数:35,代码来源:port_latency.cpp

示例8: test_vim_delete

void FakeVimPlugin::test_vim_delete()
{
    TestData data;
    setup(&data);

    data.setText("123" N "456");
    KEYS("x",  "23" N "456");
    KEYS("dd", "456");
    KEYS("2x", "6");
    KEYS("dd", "");

    data.setText("void main()");
    KEYS("dt(", "()");

    data.setText("void main()");
    KEYS("df(", ")");

    data.setText("void main()");
    KEYS("wD", "void ");
    KEYS("ggd$", "");

    data.setText("abc def ghi");
    KEYS("2dw", X "ghi");
    data.setText("abc def ghi");
    KEYS("d2w", X "ghi");

    data.setText("abc  " N "  def" N "  ghi" N "jkl");
    KEYS("3dw", X "jkl");
    data.setText("abc  " N "  def" N "  ghi" N "jkl");
    KEYS("d3w", X "jkl");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:31,代码来源:fakevim_test.cpp

示例9: Run

    virtual threadReturn_t Run()
    {
        LogText("LocklessTest::Consumer::Run started.\n");
        

        while (!FirstItemWritten)
        {
            // spin until producer wrote first value...
        }

        TestData d;
        int      oldValue = 0;
        int      newValue;

        do 
        {
            {
                //Lock::Locker scope(&TestLock);
                d = TestDataUpdater.GetState();
            }
            
            newValue = d.ReadAndCheckConsistency(oldValue);
            
            // Values should increase or stay the same!
            if (newValue < oldValue)
            {
                LogText("LocklessTest Fail - %d after %d;  delta = %d\n",
                        newValue, oldValue, newValue - oldValue);
         //       OVR_ASSERT(0);
            }
            

            if (oldValue != newValue)
            {
                oldValue = newValue;

                if (oldValue % (TestIterations/30) == 0)
                {
                    LogText("LocklessTest::Consumer - %5.2f%% done\n",
                            100.0f * (float)oldValue/(float)TestIterations);
                }
            }            

            // Spin a while
            for (int j = 0; j< 300; j++)
            {
                Dummy3 = j;
            }


        } while (oldValue < (TestIterations * 99 / 100));

        LogText("LocklessTest::Consumer::Run exiting.\n");
        return NULL;
    }
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:55,代码来源:OVR_Lockless.cpp

示例10: test_vim_copy_paste

void FakeVimPlugin::test_vim_copy_paste()
{
    TestData data;
    setup(&data);

    data.setText("123" N "456");
    KEYS("llyy2P", X "123" N "123" N "123" N "456");

    data.setText("123" N "456");
    KEYS("yyp", "123" N X "123" N "456");
    KEYS("2p", "123" N "123" N X "123" N "123" N "456");

    data.setText("123 456");
    KEYS("yw2P", "123 123" X " 123 456");
    KEYS("2p", "123 123 123 123" X " 123 456");

    data.setText("123" N "456");
    KEYS("2yyp", "123" N X "123" N "456" N "456");

    data.setText("123" N "456");
    KEYS("2yyP", X "123" N "456" N "123" N "456");

    data.setText("123" N "456" N "789");
    KEYS("ddp", "456" N X "123" N "789");

    // block-select middle column, copy and paste twice
    data.setText("123" N "456");
    KEYS("l<C-v>j\"xy2\"xp", "12" X "223" N "45556");

    data.setText("123" N "456" N "789");
    KEYS("wyiw" "wviwp", "123" N "456" N "45" X "6");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:32,代码来源:fakevim_test.cpp

示例11: TestData

	// copy constructor for batch processing
	TestData(const TestData &other, const int startRow, const int n)
	{
		assert(other.M() > 0);
		assert(startRow <= other.M());
		assert(n > 0);
		if(other.M() > 0 && startRow <= other.M() && n > 0)
		{
			//m_pXs.reset(new Matrix(n, other.D()));
			//m_pXs->noalias() = other.m_pXs->middleRows(startRow, n);
			m_pXs.reset(new Matrix(other.m_pXs->middleRows(startRow, n)));
		}
	}
开发者ID:kanster,项目名称:OpenGP,代码行数:13,代码来源:TestData.hpp

示例12: start

void Runner::start() {

	char date[5] = "date";

	curSampleSize = minSampleSize;
	std::vector <Coordinate> coords;
	TestData data;

	BruteForce bruteforce;
	QuickHull quickhull;
	Jarvis jarvis;

	std::cout << "\n==========================================\n";
	std::cout << "\n           Convex Hull Analyzer           \n";
	std::cout << "\n====== "  <<   exec(date)   <<  " ======\n\n";

	while (curSampleSize <= maxSampleSize) {

		std::vector <Coordinate> random, homogeneous, sorted, reverse, circular;

		random = data.generateRandom(curSampleSize, bounds);
		sorted = data.generateSorted(curSampleSize, bounds);
		reverse = data.generateReverseSorted(curSampleSize, bounds);
		circular = data.generateCircle(curSampleSize);

		for (int i = 0; i < 5; ++i) {

			// Quick Hull Algorithm
			save(test(quickhull, random, "random"));
			save(test(quickhull, sorted, "sorted"));
			save(test(quickhull, reverse, "reverse"));
			save(test(quickhull, circular, "circular"));

			// Jarvis March Algorithm
			save(test(jarvis, random, "random"));
			save(test(jarvis, sorted, "sorted"));
			save(test(jarvis, reverse, "reverse"));
			if (curSampleSize <= 100000) { // takes too long after 100k points
				save(test(jarvis, circular, "circular"));
			}

			// Brute Force Algorithm
			if (curSampleSize <= 100000) { // takes too long after 100k points
				save(test(bruteforce, random, "random"));
				save(test(bruteforce, sorted, "sorted"));
				save(test(bruteforce, reverse, "reverse"));
				save(test(bruteforce, circular, "circular"));
			}
		}

		curSampleSize = increaseSampleSize(curSampleSize);
	}
}
开发者ID:joeYeager,项目名称:convexical-journey,代码行数:53,代码来源:runner.cpp

示例13: readXMLDoc

TestData readXMLDoc() {

    XMLDocument doc;
#ifdef WIN32
    XMLCheckResult(doc.LoadFile("../../test/mpw_tests.xml"));
#else
    XMLCheckResult(doc.LoadFile("mpw_tests.xml"));
#endif

    TestData data;
    XMLNode * pRoot = doc.FirstChild();
    if (pRoot == 0) return data;

    XMLElement * pListElement = pRoot->FirstChildElement("case");
    TestData testData;

    while (pListElement != 0) {
        //We have a test case. Allocate memory for it.
        TestCase testCase;

        //Get the ID of this case
        std::string id = pListElement->Attribute("id");
        std::cout << "ID: " << id << std::endl;

        //Now check if we have a parent.
        const char* pParent = pListElement->Attribute("parent");
        if (pParent) {
            testCase = testData.at(pParent);
        }

        //Now fill in the data from this node.
        XMLElement * pNodeListElement = pListElement->FirstChildElement();
        while (pNodeListElement != 0) {
            const char* name = pNodeListElement->Name();
            const char* value = pNodeListElement->GetText();
            if (value != 0) {
                testCase[name] = value;
                std::cout << name << ": " << testCase[name] << std::endl;
            }
            else {
                testCase[name] = "";
                std::cout << name << ": " << "null" << std::endl;
            }
            pNodeListElement = pNodeListElement->NextSiblingElement();
        }

        testData[id] = testCase;

        pListElement = pListElement->NextSiblingElement("case");
    }

    return testData;
}
开发者ID:cuardin,项目名称:MasterPassword02,代码行数:53,代码来源:StandardizedTestSuite.cpp

示例14: main

int main() 
{
	ifstream fin;
	HashTable< TestData, string> accountTable( 8 );
	string firstName, passw;
	TestData accountInfo;

	fin.clear();
	fin.open( "password.dat" );
	while( fin.good() )
	{
		fin >> firstName;
		fin >> passw;
		if( fin.good() )
		{
			accountInfo.setKey( firstName );
			accountInfo.setPassword( passw );
			accountTable.insert( accountInfo );
		}
	}

	accountTable.showStructure();

	cout << "Login: ";
	while( cin >> firstName )
	{
		cout << "Password: ";
		cin >> passw;
		if( accountTable.retrieve( firstName, accountInfo ) )
		{
			if( accountInfo.getPassword() == passw )
			{
				cout << "Authentication successful" << endl;
			}
			else
			{
				cout << "Authentication failure" << endl;
			}
		}
		else
		{
			cout << "Authentication failure" << endl;
		}
		cout << "Login: ";


	}
	

    return 0;
}
开发者ID:rtiinuma,项目名称:Data-Structures-CS302,代码行数:51,代码来源:login.cpp

示例15: test_vim_block_selection

void FakeVimPlugin::test_vim_block_selection()
{
    TestData data;
    setup(&data);

    data.setText("int main(int /* (unused) */, char *argv[]);");
    KEYS("f(", "int main" X "(int /* (unused) */, char *argv[]);");
    KEYS("da(", "int main" X ";")

    data.setText("int main(int /* (unused) */, char *argv[]);");
    KEYS("f(", "int main" X "(int /* (unused) */, char *argv[]);");
    KEYS("di(", "int main(" X ");")

    data.setText("int main(int /* (unused) */, char *argv[]);");
    KEYS("2f)", "int main(int /* (unused) */, char *argv[]" X ");");
    KEYS("da(", "int main" X ";")

    data.setText("int main(int /* (unused) */, char *argv[]);");
    KEYS("2f)", "int main(int /* (unused) */, char *argv[]" X ");");
    KEYS("di(", "int main(" X ");")

    data.setText("{ { { } } }");
    KEYS("2f{l", "{ { {" X " } } }")
    KEYS("da{", "{ { " X " } }")
    KEYS("da{", "{ " X " }")

    data.setText("{ { { } } }");
    KEYS("2f{l", "{ { {" X " } } }")
    KEYS("2da{", "{ " X " }")

    data.setText("{" N " { " N " } " N "}");
    KEYS("di{", "{" N "}")
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:33,代码来源:fakevim_test.cpp


注:本文中的TestData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。