示例#1
0
void test_const_rand_acc_iter_const() {
	dynArray<int> const test { 1, 2, 3, 4, 5, 6, 7, 8, 6 };

	int erg { std::accumulate(test.cbegin(), test.cend(), 0) };

	ASSERT_EQUAL(42, erg);
}
示例#2
0
文件: Test.cpp 项目: flomerz/dynArray
void testReverseIterConst() {
	std::ostringstream out { };
	std::ostream_iterator<char> const out_iter(out, "");
	dynArray<char> const test { 'o', 'l', 'l', 'a', 'h' };
	std::copy(test.rbegin(), test.rend(), out_iter);
	ASSERT_EQUAL("hallo", out.str());
}
示例#3
0
void test_rev_iter_const() {
	std::ostringstream out { };
	std::ostream_iterator<int> out_iter(out, "");
	dynArray<int> const test { 2, 4 };

	std::copy(test.rbegin(), test.rend(), out_iter);

	ASSERT_EQUAL("42", out.str());
}
示例#4
0
void test_rand_acc_iter_const() {
	std::ostringstream out { };
	std::ostream_iterator<std::string> out_iter(out, " ");
	dynArray<std::string> const test { "42", "is", "always", "the", "answer" };

	std::copy(test.begin(), test.end(), out_iter);

	ASSERT_EQUAL("42 is always the answer ", out.str());
}
示例#5
0
dynArray dynArray::operator =(dynArray &right)
{
	ensuresize(right.nelements);
	nelements=right.nelements;
	for(int i=0;i<nelements;i++)
	{
		this->elems[i]=right.getelem(i);
	}
	curmax=right.curmax;
	return *this;
}
示例#6
0
void test_at_func_const() {
	dynArray<int> const test { 1, 3, 5, 42, 9 };

	ASSERT_EQUAL(42, test.at(3));
}
示例#7
0
void test_func_back_const() {
	dynArray<std::string> const test { "hello", "what's", "up" };

	ASSERT_EQUAL("up", test.back());
}
示例#8
0
void test_func_front_const() {
	dynArray<double> const test { 42.0, 2.0, 3.0, 4.0 };

	ASSERT_EQUAL(42.0, test.front());
}
示例#9
0
文件: Test.cpp 项目: flomerz/dynArray
void testBackConst() {
	std::vector<int> const iu { 1, 2, 5 };
	dynArray<int> const dyniu { 1, 2, 5 };
	ASSERT_EQUAL(iu.back(), dyniu.back());
}
示例#10
0
文件: Test.cpp 项目: flomerz/dynArray
void testFrontConst() {
	std::vector<int> const iu { 1, 2, 5 };
	dynArray<int> const dyniu { 1, 2, 5 };
	ASSERT_EQUAL(iu.front(), dyniu.front());
}