本文整理汇总了C++中Spec::it方法的典型用法代码示例。如果您正苦于以下问题:C++ Spec::it方法的具体用法?C++ Spec::it怎么用?C++ Spec::it使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spec
的用法示例。
在下文中一共展示了Spec::it方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_find_representatives
void test_find_representatives() {
static const string useful_columns[] = {
cFirstname::static_get_class_name(),
cMiddlename::static_get_class_name(),
cLastname::static_get_class_name(),
cLatitude::static_get_class_name(),
cAssignee::static_get_class_name(),
cCity::static_get_class_name(),
cCountry::static_get_class_name()
};
static const uint32_t numcols = sizeof(useful_columns)/sizeof(string);
vector<uint32_t> indice = make_indice(useful_columns,numcols);
Spec spec;
spec.it("Indexing for find_representatives", [&indice](Description desc)->bool {
vector<uint32_t> test = { 0, 2, 1, 7, 4, 10, 11 };
return (test == indice);
});
const Record * r1 = rpv[1];
const Record * r2 = rpv[2];
const Record * r3 = rpv[3];
typedef std::pair<const Attribute *, uint32_t> AttCount;
typedef map<const Attribute *, uint32_t> AttCounts;
RecordPList m_fellows = { r1, r2, r3 };
vector<AttCounts> trace = make_trace(indice, m_fellows, numcols);
#if 0 /// Save all this it's really useful
for_each(begin(trace), end(trace), [](AttCounts acs) {
for_each(begin(acs), end(acs), [](AttCount ac) {
const vector<const string*> & data = ac.first->get_data();
for_each(begin(data), end(data), [](const string * s) {
std::cout << "Att: " << s->c_str() << ", ";
});
std::cout << "count: " << ac.second << std::endl;
});
});
#endif
vector<const Attribute *> most = get_most(trace, numcols);
const Record * mp = get_record_with_most(most, m_fellows, indice, numcols);
//mp->print();
spec.it("Unique record ID for cluster representative should be 06453319-4", [mp](Description desc)->bool {
const string uid = mp->get_unique_record_id();
return (uid == string("06453319-4"));
});
}
示例2: testem_all
void testem_all() {
Spec spec;
spec.it("Comparing two empty strings scores 0", [this](Description desc)->bool {
s1 = ""; s2 = "";
int score = jwcmp(s1, s2);
//print_score(s1, s2, score);
return (0 == score);
});
spec.it("Comparing %s with %s results in %d", [this, &spec](Description desc)->bool {
s1 = "MATTHEW"; s2 = "XYZ";
int score = jwcmp(s1, s2);
sprintf(spec.buf, desc, s1.c_str(), s2.c_str(), score);
return (0 == score);
});
spec.it("Comparing %s with %s results in %d", [this, &spec](Description desc)->bool {
s1 = "MATTHEW"; s2 = "TALIN";
int score = jwcmp(s1, s2);
sprintf(spec.buf, desc, s1.c_str(), s2.c_str(), score);
return (0 == score);
});
spec.it("Comparing %s with %s results in %d", [this, &spec](Description desc)->bool {
s1 = "MATTHEW"; s2 = "MATHEW";
int score = jwcmp(s1, s2);
sprintf(spec.buf, desc, s1.c_str(), s2.c_str(), score);
return (4 == score);
});
spec.it("Comparing %s with %s results in %d", [this, &spec](Description desc)->bool {
s1 = "MATTHEW"; s2 = "MATTHEW";
int score = jwcmp(s1, s2);
sprintf(spec.buf, desc, s1.c_str(), s2.c_str(), score);
return (5 == score);
});
}
示例3: create_clusterhead
void create_clusterhead() {
Spec spec;
Record * representative = make_foobar_record();
spec.it("Creates a ClusterHead", [representative](Description desc)->bool {
double cohesion = 0.9953;
ClusterHead ch(representative, cohesion);
return (cohesion == ch.m_cohesion);
});
// Segfaults...
//r->print();
// segfaults, which shouldn't be...
// Leaks, bad
//r->clean_member_attrib_pool();
//std::cout << "sizeof(r): " << sizeof(*r) << std::endl;
delete representative;
}