added print
This commit is contained in:
@@ -3,85 +3,50 @@
|
||||
|
||||
#include "tests_utils.hpp"
|
||||
|
||||
//TEST2(test_simple(), "test")
|
||||
TEST(test_simple)
|
||||
TEST(tests_vector_constructor)
|
||||
{
|
||||
// title
|
||||
TITLE(cplusplus.com reference)
|
||||
|
||||
T myints[] = {VAL(16),VAL(2),VAL(77),VAL(29)};
|
||||
ft::vector<T> myvector (myints, myints + sizeof(myints) / sizeof(T) );
|
||||
// constructors used in the same order as described above:
|
||||
ft::vector<T> first; // empty vector of ints
|
||||
ft::vector<T> second (4,VAL(100)); // four ints with value 100
|
||||
ft::vector<T> third (second.begin(),second.end()); // iterating through second
|
||||
ft::vector<T> fourth (third); // a copy of third
|
||||
|
||||
for (typename ft::vector<T>::iterator it = myvector.begin(); it != myvector.end(); ++it)
|
||||
std::cout << ' ' << *it;
|
||||
std::cout << '\n';
|
||||
// the iterator constructor can also be used to construct from arrays:
|
||||
T myints[] = {VAL(16),VAL(2),VAL(77),VAL(29)};
|
||||
ft::vector<T> fifth (myints, myints + sizeof(myints) / sizeof(T) );
|
||||
|
||||
PRINT(fifth);
|
||||
}
|
||||
|
||||
TEST(tests_vector_operator_assignation)
|
||||
{
|
||||
// title
|
||||
TITLE(cplusplus.com reference)
|
||||
|
||||
ft::vector<T> foo (3,VAL(0));
|
||||
ft::vector<T> bar (5,VAL(0));
|
||||
|
||||
bar = foo;
|
||||
foo = ft::vector<T>();
|
||||
|
||||
std::cout << "Size of foo: " << int(foo.size()) << '\n';
|
||||
std::cout << "Size of bar: " << int(bar.size()) << '\n';
|
||||
|
||||
|
||||
// title
|
||||
TITLE(more informations)
|
||||
|
||||
std::cout << "foo:\n";
|
||||
PRINT(foo);
|
||||
|
||||
std::cout << "bar:\n";
|
||||
PRINT(bar);
|
||||
}
|
||||
//TEST2END
|
||||
|
||||
/*
|
||||
void tests_vector_constructor()
|
||||
{
|
||||
TEST(vector::vector (constructor))
|
||||
{
|
||||
// title
|
||||
TITLE(cplusplus.com reference)
|
||||
|
||||
// constructors used in the same order as described above:
|
||||
ft::vector<int> first; // empty vector of ints
|
||||
ft::vector<int> second (4,100); // four ints with value 100
|
||||
ft::vector<int> third (second.begin(),second.end()); // iterating through second
|
||||
ft::vector<int> fourth (third); // a copy of third
|
||||
|
||||
// the iterator constructor can also be used to construct from arrays:
|
||||
int myints[] = {16,2,77,29};
|
||||
ft::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
|
||||
|
||||
std::cout << "The contents of fifth are:";
|
||||
for (ft::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
|
||||
std::cout << ' ' << *it;
|
||||
std::cout << '\n';
|
||||
}
|
||||
TESTEND
|
||||
}
|
||||
|
||||
void tests_vector_operator_assignation()
|
||||
{
|
||||
TEST(vector::=operator)
|
||||
{
|
||||
// title
|
||||
TITLE(cplusplus.com reference)
|
||||
|
||||
ft::vector<int> foo (3,0);
|
||||
ft::vector<int> bar (5,0);
|
||||
|
||||
bar = foo;
|
||||
foo = ft::vector<int>();
|
||||
|
||||
std::cout << "Size of foo: " << int(foo.size()) << '\n';
|
||||
std::cout << "Size of bar: " << int(bar.size()) << '\n';
|
||||
|
||||
|
||||
// title
|
||||
TITLE(more informations)
|
||||
|
||||
int size;
|
||||
|
||||
size = foo.size();
|
||||
std::cout << "foo:\n";
|
||||
for (int i = 0; i < size; i++)
|
||||
std::cout << "[" << i <<"]" << foo[i];
|
||||
std::cout << "\ncapacity: " << foo.capacity() << "\n";
|
||||
|
||||
size = bar.size();
|
||||
std::cout << "bar:\n";
|
||||
for (int i = 0; i < size; i++)
|
||||
std::cout << "[" << i <<"]" << bar[i];
|
||||
std::cout << "\ncapacity: " << bar.capacity() << "\n";
|
||||
|
||||
}
|
||||
TESTEND
|
||||
}
|
||||
|
||||
void tests_vector_begin() {
|
||||
TEST(vector::begin)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user