本文整理汇总了C++中CXXTOOLS_UNIT_ASSERT_EQUALS函数的典型用法代码示例。如果您正苦于以下问题:C++ CXXTOOLS_UNIT_ASSERT_EQUALS函数的具体用法?C++ CXXTOOLS_UNIT_ASSERT_EQUALS怎么用?C++ CXXTOOLS_UNIT_ASSERT_EQUALS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CXXTOOLS_UNIT_ASSERT_EQUALS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: testQueryParams
void testQueryParams()
{
cxxtools::QueryParams q;
q.add("p1", "value1");
q.add("p2", "value2");
q.add("value3");
CXXTOOLS_UNIT_ASSERT(q.has("p1"));
CXXTOOLS_UNIT_ASSERT(q.has("p2"));
CXXTOOLS_UNIT_ASSERT(!q.has("p3"));
CXXTOOLS_UNIT_ASSERT_EQUALS(q["p1"], "value1");
CXXTOOLS_UNIT_ASSERT_EQUALS(q["p2"], "value2");
CXXTOOLS_UNIT_ASSERT_EQUALS(q[0], "value3");
}
开发者ID:913862627,项目名称:cxxtools,代码行数:13,代码来源:query_params-test.cpp
示例2: muldiv
void muldiv()
{
cxxtools::Seconds t1(2500);
cxxtools::Timespan d = t1 * 2.0;
CXXTOOLS_UNIT_ASSERT_EQUALS(d, cxxtools::Seconds(5000));
d = 3.0 * t1;
CXXTOOLS_UNIT_ASSERT_EQUALS(d, cxxtools::Seconds(7500));
d = t1 / 2.0;
CXXTOOLS_UNIT_ASSERT_EQUALS(d, cxxtools::Seconds(1250));
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:13,代码来源:timespan-test.cpp
示例3: testCopy
void testCopy()
{
cxxtools::QueryParams q;
q.add("p1", "value1");
q.add("p2", "value2");
q.add("value3");
cxxtools::QueryParams q2 = q;
CXXTOOLS_UNIT_ASSERT(q2.has("p1"));
CXXTOOLS_UNIT_ASSERT(q2.has("p2"));
CXXTOOLS_UNIT_ASSERT(!q2.has("p3"));
CXXTOOLS_UNIT_ASSERT_EQUALS(q2["p1"], "value1");
CXXTOOLS_UNIT_ASSERT_EQUALS(q2["p2"], "value2");
CXXTOOLS_UNIT_ASSERT_EQUALS(q2[0], "value3");
}
开发者ID:913862627,项目名称:cxxtools,代码行数:14,代码来源:query_params-test.cpp
示例4: s
void StringTest::testReserve()
{
const cxxtools::Char c1[] = { 'a', 'b', 'c', 'd', '\0' };
cxxtools::String s(L"abcd");
cxxtools::String s2 = s;
s2.reserve(10);
CXXTOOLS_UNIT_ASSERT( s2.capacity() >= 10 );
CXXTOOLS_UNIT_ASSERT( s2.size() == 4 );
CXXTOOLS_UNIT_ASSERT_EQUALS( std::char_traits<cxxtools::Char>::compare(s2.c_str(), c1, 4) , 0 );
CXXTOOLS_UNIT_ASSERT( s.capacity() >= 4 );
CXXTOOLS_UNIT_ASSERT_EQUALS( s.size(), 4 );
CXXTOOLS_UNIT_ASSERT_EQUALS( std::char_traits<cxxtools::Char>::compare(s.c_str(), c1, 4) , 0 );
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:15,代码来源:string-test.cpp
示例5: testArgChar
void testArgChar()
{
int argc = 5;
char* argv[] = { arg("prog"), arg("-D"), arg("A"), arg("-F"), arg("\t"), 0 };
cxxtools::Arg<char> optionA(argc, argv, 'A');
cxxtools::Arg<char> optionD(argc, argv, 'D');
cxxtools::Arg<char> optionF(argc, argv, 'F');
CXXTOOLS_UNIT_ASSERT(!optionA.isSet());
CXXTOOLS_UNIT_ASSERT(optionD.isSet());
CXXTOOLS_UNIT_ASSERT(optionF.isSet());
CXXTOOLS_UNIT_ASSERT_EQUALS(*optionD, 'A');
CXXTOOLS_UNIT_ASSERT_EQUALS(*optionF, '\t');
CXXTOOLS_UNIT_ASSERT_EQUALS(argc, 1);
}
开发者ID:maekitalo,项目名称:cxxtools,代码行数:15,代码来源:arg-test.cpp
示例6: multipartMessage
void multipartMessage()
{
cxxtools::MimeMultipart mp;
mp.addObject();
mp.addObject();
CXXTOOLS_UNIT_ASSERT_EQUALS(mp.size(), 2);
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:7,代码来源:mime-test.cpp
示例7: bunzip2OstreamTest
void bunzip2OstreamTest()
{
// test
std::stringstream bzip2target;
{
zim::Bzip2Stream compressor(bzip2target);
compressor << testtext << std::flush;
compressor.end();
}
{
std::ostringstream msg;
msg << "teststring with " << testtext.size() << " bytes compressed into " << bzip2target.str().size() << " bytes";
reportMessage(msg.str());
}
std::ostringstream bunzip2target;
{
zim::Bunzip2Stream bunzip2(bunzip2target); // bunzip2 is a ostream here
bunzip2 << bzip2target.str() << std::flush;
}
{
std::ostringstream msg;
msg << "teststring uncompressed to " << bunzip2target.str().size() << " bytes";
reportMessage(msg.str());
}
CXXTOOLS_UNIT_ASSERT_EQUALS(testtext, bunzip2target.str());
}
开发者ID:cscott,项目名称:openzim,代码行数:32,代码来源:bzip2stream.cpp
示例8: inflatorOstreamTest
void inflatorOstreamTest()
{
// test
std::stringstream deflatetarget;
zim::DeflateStream deflator(deflatetarget);
deflator << testtext << std::flush;
{
std::ostringstream msg;
msg << "teststring with " << testtext.size() << " bytes compressed into " << deflatetarget.str().size() << " bytes";
reportMessage(msg.str());
}
std::ostringstream inflatetarget;
zim::InflateStream inflator(inflatetarget); // inflator is a ostream here
inflator << deflatetarget.str() << std::flush;
{
std::ostringstream msg;
msg << "teststring uncompressed to " << inflatetarget.str().size() << " bytes";
reportMessage(msg.str());
}
CXXTOOLS_UNIT_ASSERT_EQUALS(testtext, inflatetarget.str());
}
开发者ID:cip,项目名称:zimlib,代码行数:25,代码来源:zlibstream.cpp
示例9: Multiple
////////////////////////////////////////////////////////////
// Multiple calls
//
void Multiple()
{
_server->registerMethod("multiply", *this, &BinRpcTest::multiplyDouble);
typedef cxxtools::RemoteProcedure<double, double, double> Multiply;
std::vector<cxxtools::bin::RpcClient> clients;
std::vector<Multiply> procs;
clients.reserve(16);
procs.reserve(16);
for (unsigned i = 0; i < 16; ++i)
{
clients.push_back(cxxtools::bin::RpcClient(_loop, "", _port));
procs.push_back(Multiply(clients.back(), "multiply"));
procs.back().begin(i, i);
}
for (unsigned i = 0; i < 16; ++i)
{
CXXTOOLS_UNIT_ASSERT_EQUALS(procs[i].end(2000), i*i);
}
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:28,代码来源:binrpc-test.cpp
示例10: testPlainInt
void testPlainInt()
{
std::ostringstream out;
cxxtools::JsonSerializer serializer(out);
serializer.serialize(-4711).finish();
CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "-4711");
}
开发者ID:gema-arta,项目名称:zim-vendor,代码行数:8,代码来源:jsonserializer-test.cpp
示例11: testPlainEmpty
void testPlainEmpty()
{
std::ostringstream out;
cxxtools::JsonSerializer serializer(out);
serializer.finish();
CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "");
}
开发者ID:gema-arta,项目名称:zim-vendor,代码行数:8,代码来源:jsonserializer-test.cpp
示例12: testInt
void testInt()
{
std::ostringstream out;
cxxtools::JsonSerializer serializer(out);
serializer.serialize(-4711, "value").finish();
CXXTOOLS_UNIT_ASSERT_EQUALS(out.str(), "{\"value\":-4711}");
}
开发者ID:gema-arta,项目名称:zim-vendor,代码行数:8,代码来源:jsonserializer-test.cpp
示例13: Array
////////////////////////////////////////////////////////////
// Array
//
void Array()
{
_server->registerMethod("multiply", *this, &BinRpcTest::multiplyVector);
cxxtools::bin::RpcClient client(_loop, "", _port);
cxxtools::RemoteProcedure< std::vector<int>, std::vector<int>, std::vector<int> > multiply(client, "multiply");
std::vector<int> vec;
vec.push_back(10);
vec.push_back(20);
multiply.begin(vec, vec);
std::vector<int> r = multiply.end(2000);
CXXTOOLS_UNIT_ASSERT_EQUALS(r.size(), 2);
CXXTOOLS_UNIT_ASSERT_EQUALS(r.at(0), 100);
CXXTOOLS_UNIT_ASSERT_EQUALS(r.at(1), 400);
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:20,代码来源:binrpc-test.cpp
示例14: Connect
////////////////////////////////////////////////////////////
// Connect
//
void Connect()
{
_server->registerMethod("boolean", *this, &BinRpcTest::boolean);
// test connect using cxxtools::net::AddrInfo
{
cxxtools::bin::RpcClient client(_loop);
cxxtools::RemoteProcedure<bool, bool, bool> boolean(client, "boolean");
client.connect(cxxtools::net::AddrInfo("", _port));
boolean.begin(true, true);
CXXTOOLS_UNIT_ASSERT_EQUALS(boolean.end(2000), true);
}
// test connect using host and port
{
cxxtools::bin::RpcClient client(_loop);
cxxtools::RemoteProcedure<bool, bool, bool> boolean(client, "boolean");
client.connect("", _port);
boolean.begin(true, true);
CXXTOOLS_UNIT_ASSERT_EQUALS(boolean.end(2000), true);
}
// test connect using uri
{
cxxtools::bin::RpcClient client(_loop);
cxxtools::RemoteProcedure<bool, bool, bool> boolean(client, "boolean");
std::ostringstream uri;
uri << "http://localhost:" << _port << '/';
client.connect(cxxtools::net::Uri(uri.str()));
boolean.begin(true, true);
CXXTOOLS_UNIT_ASSERT_EQUALS(boolean.end(2000), true);
}
// test failing connect
{
cxxtools::bin::RpcClient client(_loop);
cxxtools::RemoteProcedure<bool, bool, bool> boolean(client, "boolean");
CXXTOOLS_UNIT_ASSERT_THROW(client.connect("", _port + 1), cxxtools::IOError);
}
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:48,代码来源:binrpc-test.cpp
示例15: testArgBool
void testArgBool()
{
int argc = 7;
char* argv[] = { arg("prog"), arg("-i"), arg("-j"), arg("-k"),
arg("-cf"), arg("--foo"), arg("foo"), 0 };
cxxtools::Arg<bool> optionJ(argc, argv, 'j');
cxxtools::Arg<bool> optionL(argc, argv, 'l');
cxxtools::Arg<bool> optionC(argc, argv, 'c');
cxxtools::Arg<bool> optionFoo(argc, argv, "--foo");
cxxtools::Arg<bool> optionBar(argc, argv, "--bar");
CXXTOOLS_UNIT_ASSERT(optionJ);
CXXTOOLS_UNIT_ASSERT(!optionL);
CXXTOOLS_UNIT_ASSERT(optionC);
CXXTOOLS_UNIT_ASSERT(optionFoo);
CXXTOOLS_UNIT_ASSERT(!optionBar);
CXXTOOLS_UNIT_ASSERT_EQUALS(argc, 5);
CXXTOOLS_UNIT_ASSERT_EQUALS(strcmp(argv[0], "prog"), 0);
CXXTOOLS_UNIT_ASSERT_EQUALS(strcmp(argv[1], "-i"), 0);
CXXTOOLS_UNIT_ASSERT_EQUALS(strcmp(argv[2], "-k"), 0);
CXXTOOLS_UNIT_ASSERT_EQUALS(strcmp(argv[3], "-f"), 0);
CXXTOOLS_UNIT_ASSERT_EQUALS(strcmp(argv[4], "foo"), 0);
CXXTOOLS_UNIT_ASSERT_EQUALS(argv[5], static_cast<const char*>(0));
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:25,代码来源:arg-test.cpp
示例16: poolTest
void poolTest()
{
{
typedef cxxtools::Pool<Object> PoolType;
PoolType pool;
{
PoolType::Ptr p = pool.get();
CXXTOOLS_UNIT_ASSERT_EQUALS(pool.size(), 0);
CXXTOOLS_UNIT_ASSERT_EQUALS(Object::ctorCount, 1);
}
CXXTOOLS_UNIT_ASSERT_EQUALS(pool.size(), 1);
{
PoolType::Ptr p = pool.get();
CXXTOOLS_UNIT_ASSERT_EQUALS(pool.size(), 0);
}
CXXTOOLS_UNIT_ASSERT_EQUALS(pool.size(), 1);
CXXTOOLS_UNIT_ASSERT_EQUALS(Object::ctorCount, 1);
}
CXXTOOLS_UNIT_ASSERT_EQUALS(Object::instCount, 0);
}
开发者ID:913862627,项目名称:cxxtools,代码行数:25,代码来源:pool-test.cpp
示例17: serialize
void serialize()
{
cxxtools::Timespan t(1234567);
cxxtools::SerializationInfo si;
si <<= t;
cxxtools::Timespan t2;
si >>= t2;
CXXTOOLS_UNIT_ASSERT_EQUALS(t, t2);
}
开发者ID:acklinr,项目名称:cxxtools,代码行数:9,代码来源:timespan-test.cpp
示例18: testPlain
void testPlain()
{
std::string src = "<html><body><h1>Hello World!<h1>\n</body></html>";
std::istringstream ecpp(src);
Handler handler;
tnt::ecpp::Parser parser(handler, std::string());
parser.parse(ecpp);
CXXTOOLS_UNIT_ASSERT_EQUALS(handler.result(), "start()onHtml(" + src + ")end()");
}
开发者ID:913862627,项目名称:tntnet,代码行数:9,代码来源:ecpptest.cpp
示例19: testPre
void testPre()
{
std::string src = "<foo><%pre> #include <iostream> </%pre></foo>";
std::istringstream ecpp(src);
Handler handler;
tnt::ecpp::Parser parser(handler, std::string());
parser.parse(ecpp);
CXXTOOLS_UNIT_ASSERT_EQUALS(handler.result(), "start()onHtml(<foo>)onPre( #include <iostream> )onHtml(</foo>)end()");
}
开发者ID:913862627,项目名称:tntnet,代码行数:9,代码来源:ecpptest.cpp
示例20: testStringArgs
void testStringArgs()
{
std::string src = "<foo><%args> foo=\"bar\"; </%args></foo>";
std::istringstream ecpp(src);
Handler handler;
tnt::ecpp::Parser parser(handler, std::string());
parser.parse(ecpp);
CXXTOOLS_UNIT_ASSERT_EQUALS(handler.result(), "start()onHtml(<foo>)onArg(foo, \"bar\")onHtml(</foo>)end()");
}
开发者ID:913862627,项目名称:tntnet,代码行数:9,代码来源:ecpptest.cpp
注:本文中的CXXTOOLS_UNIT_ASSERT_EQUALS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论