diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-08-17 19:31:37 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-08-17 19:31:37 -0300 |
commit | e0c29962e6f334452f0c9db2caaf6ed18065de85 (patch) | |
tree | cee27801c196fbcacf6130ad64216af133b555dd /tests/libsample/listuser.cpp |
The End Is the Beginning Is the End
Diffstat (limited to 'tests/libsample/listuser.cpp')
-rw-r--r-- | tests/libsample/listuser.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/libsample/listuser.cpp b/tests/libsample/listuser.cpp new file mode 100644 index 000000000..0b9a14ff5 --- /dev/null +++ b/tests/libsample/listuser.cpp @@ -0,0 +1,47 @@ +#include <iostream> +#include <numeric> +#include <cstdlib> +#include "listuser.h" + +using namespace std; + +std::list<int> +ListUser::callCreateList() +{ + cout << __PRETTY_FUNCTION__ << endl; + return createList(); +} + +std::list<int> +ListUser::createList() +{ + cout << __PRETTY_FUNCTION__ << endl; + std::list<int> retval; + for (int i = 0; i < 4; i++) + retval.push_front(rand()); + return retval; +} + +std::list<Complex> +ListUser::createComplexList(Complex cpx0, Complex cpx1) +{ + cout << __PRETTY_FUNCTION__ << endl; + std::list<Complex> retval; + retval.push_back(cpx0); + retval.push_back(cpx1); + return retval; +} + +double +ListUser::sumList(std::list<int> vallist) +{ + return std::accumulate(vallist.begin(), vallist.end(), 0.0); +} + +double +ListUser::sumList(std::list<double> vallist) +{ + return std::accumulate(vallist.begin(), vallist.end(), 0.0); +} + + |