本文整理汇总了C++中TestData类的典型用法代码示例。如果您正苦于以下问题:C++ TestData类的具体用法?C++ TestData怎么用?C++ TestData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: test_advanced_commands
void FakeVimPlugin::test_advanced_commands()
{
TestData data;
setup(&data);
// subcommands
data.setText("abc" N " xxx" N " xxx" N "def");
COMMAND("%s/xxx/ZZZ/g|%s/ZZZ/OOO/g", "abc" N " OOO" N " " X "OOO" N "def");
// undo/redo all subcommands
COMMAND(":undo", "abc" N X " xxx" N " xxx" N "def");
COMMAND(":redo", "abc" N X " OOO" N " OOO" N "def");
// redundant characters
COMMAND("::: %s/\\S\\S\\S/ZZZ/g | :::: %s/ZZZ/XXX/g ", "XXX" N " XXX" N " XXX" N X "XXX");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:16,代码来源:fakevim_test.cpp
示例17: test_vim_transform_numbers
void FakeVimPlugin::test_vim_transform_numbers()
{
TestData data;
setup(&data);
data.setText("8");
KEYS("<c-a>", X "9");
KEYS("<c-x>", X "8");
KEYS("<c-a>", X "9");
KEYS("<c-a>", "1" X "0");
KEYS("<c-a>", "1" X "1");
KEYS("5<c-a>", "1" X "6");
KEYS("10<c-a>", "2" X "6");
KEYS("h100<c-a>", "12" X "6");
KEYS("100<c-x>", "2" X "6");
KEYS("10<c-x>", "1" X "6");
KEYS("5<c-x>", "1" X "1");
KEYS("5<c-x>", X "6");
KEYS("6<c-x>", X "0");
KEYS("<c-x>", "-" X "1");
KEYS("h10<c-x>", "-1" X "1");
KEYS("h100<c-x>", "-11" X "1");
KEYS("h889<c-x>", "-100" X "0");
// increase nearest number
data.setText("x-x+x: 1 2 3 -4 5");
KEYS("8<c-a>", "x-x+x: " X "9 2 3 -4 5");
KEYS("l8<c-a>", "x-x+x: 9 1" X "0 3 -4 5");
KEYS("l8<c-a>", "x-x+x: 9 10 1" X "1 -4 5");
KEYS("l16<c-a>", "x-x+x: 9 10 11 1" X "2 5");
KEYS("w18<c-x>", "x-x+x: 9 10 11 12 -1" X "3");
KEYS("hh13<c-a>", "x-x+x: 9 10 11 12 " X "0");
KEYS("B12<c-x>", "x-x+x: 9 10 11 " X "0 0");
KEYS("B11<c-x>", "x-x+x: 9 10 " X "0 0 0");
KEYS("B10<c-x>", "x-x+x: 9 " X "0 0 0 0");
KEYS("B9<c-x>", "x-x+x: " X "0 0 0 0 0");
KEYS("B9<c-x>", "x-x+x: -" X "9 0 0 0 0");
data.setText("-- 1 --");
KEYS("<c-x>", "-- " X "0 --");
KEYS("<c-x><c-x>", "-- -" X "2 --");
KEYS("2<c-a><c-a>", "-- " X "1 --");
KEYS("<c-a>2<c-a>", "-- " X "4 --");
KEYS(".", "-- " X "6 --");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:45,代码来源:fakevim_test.cpp
示例18: test_vim_repeat
void FakeVimPlugin::test_vim_repeat()
{
TestData data;
setup(&data);
// delete line
data.setText("abc" N "def" N "ghi");
KEYS("dd", X "def" N "ghi");
KEYS(".", X "ghi");
// delete to next word
data.setText("abc def ghi jkl");
KEYS("dw", X "def ghi jkl");
KEYS("w.", "def " X "jkl");
KEYS("gg.", X "jkl");
// change in word
data.setText("WORD text");
KEYS("ciwWORD<esc>", "WOR" X "D text");
KEYS("w.", "WORD WOR" X "D");
/* QTCREATORBUG-7248 */
data.setText("test tex" X "t");
KEYS("vbcWORD<esc>", "test " "WOR" X "D");
KEYS("bb.", "WOR" X "D WORD");
// delete selected range
data.setText("abc def ghi jkl");
KEYS("viwd", X " def ghi jkl");
KEYS(".", X "f ghi jkl");
KEYS(".", X "hi jkl");
// delete two lines
data.setText("abc" N "def" N "ghi" N "jkl" N "mno");
KEYS("Vjx", X "ghi" N "jkl" N "mno");
KEYS(".", X "mno");
// delete three lines
data.setText("abc" N "def" N "ghi" N "jkl" N "mno" N "pqr" N "stu");
KEYS("d2j", X "jkl" N "mno" N "pqr" N "stu");
KEYS(".", X "stu");
// replace block selection
data.setText("abcd" N "d" X "efg" N "ghij" N "jklm");
KEYS("<c-v>jlrX", "abcd" N "d" X "XXg" N "gXXj" N "jklm");
KEYS("gg.", "XXcd" N "XXXg" N "gXXj" N "jklm");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:47,代码来源:fakevim_test.cpp
示例19: TEST
TEST(FivePointsNullspaceBasis, SatisfyEpipolarConstraint) {
TestData d = SomeTestData();
Mat E_basis = FivePointsNullspaceBasis(d.x1, d.x2);
for (int s = 0; s < 4; ++s) {
Mat3 E;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
E(i, j) = E_basis(3 * i + j, s);
}
}
for (int i = 0; i < d.x1.cols(); ++i) {
Vec3 x1(d.x1(0,i), d.x1(1,i), 1);
Vec3 x2(d.x2(0,i), d.x2(1,i), 1);
EXPECT_NEAR(0, x2.dot(E * x1), 1e-6);
}
}
}
开发者ID:yueying,项目名称:3DReconstruction,代码行数:20,代码来源:solver_essential_five_point_unittest.cpp
示例20: test_vim_fFtT
void FakeVimPlugin::test_vim_fFtT()
{
TestData data;
setup(&data);
data.setText("123()456" N "a(b(c)d)e");
KEYS("t(", "12" X "3()456" N "a(b(c)d)e");
KEYS("lt(", "123" X "()456" N "a(b(c)d)e");
KEYS("0j2t(", "123()456" N "a(" X "b(c)d)e");
KEYS("l2T(", "123()456" N "a(b" X "(c)d)e");
KEYS("l2T(", "123()456" N "a(" X "b(c)d)e");
KEYS("T(", "123()456" N "a(" X "b(c)d)e");
KEYS("ggf(", "123" X "()456" N "a(b(c)d)e");
KEYS("lf(", "123(" X ")456" N "a(b(c)d)e");
KEYS("0j2f(", "123()456" N "a(b" X "(c)d)e");
KEYS("2F(", "123()456" N "a(b" X "(c)d)e");
KEYS("l2F(", "123()456" N "a" X "(b(c)d)e");
KEYS("F(", "123()456" N "a" X "(b(c)d)e");
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:20,代码来源:fakevim_test.cpp
注:本文中的TestData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论