diff options
author | Nao Pross <naopross@thearcway.org> | 2019-02-23 13:49:23 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-02-23 13:49:23 +0100 |
commit | dd8035c87efec996164c1c0f5c78c790d72747d9 (patch) | |
tree | 7f512bc20f46b09ec85455c54c3a446a3d70fca0 /test/example.cpp | |
parent | Fix typos and other minor errors (diff) | |
download | libmm-dd8035c87efec996164c1c0f5c78c790d72747d9.tar.gz libmm-dd8035c87efec996164c1c0f5c78c790d72747d9.zip |
Add test to cmake
Diffstat (limited to 'test/example.cpp')
-rw-r--r-- | test/example.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/test/example.cpp b/test/example.cpp deleted file mode 100644 index 3a00f58..0000000 --- a/test/example.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "mmvec.hpp" - -#include <iostream> -#include <complex> - -int main(int argc, char *argv[]) { - // N dimensional vectors - std::cout << "N dimensional (int) vectors" << std::endl; - mm::vec<int, 5> u {3, 2, 1, 0, 1}; - mm::vec<int, 5> v {1, 2, 3, 4, 5}; - - std::cout << "u = " << u << std::endl; - std::cout << "v = " << v << std::endl; - std::cout << std::endl; - - // basic operations - std::cout << "u + v = " << u + v << std::endl; - std::cout << "u - v = " << u - v << std::endl; - std::cout << "2 * v = " << 2 * v << std::endl; - std::cout << "v * 2 = " << v * 2 << std::endl; - std::cout << "u * v = " << u * v << std::endl; - std::cout << std::endl; - - u += v; - - // three dimensional vectors - std::cout << "three dimensional (double) vectors" << std::endl; - - mm::vec3<double> a {1, 2, 3}; - mm::vec3<double> b {3, 2, 1}; - - std::cout << "a = " << a << std::endl; - std::cout << "b = " << b << std::endl; - std::cout << std::endl; - - std::cout << "a x b = " << mm::vec3<double>::cross(a, b) << std::endl; - std::cout << "zenith(a) = " << a.zenith() << std::endl; - std::cout << "azimuth(a) = " << a.azimuth() << std::endl; - std::cout << "spherical(a) = " << a.spherical() << std::endl; - std::cout << std::endl; - - a -= b; - - // two dimensional vector - std::cout << "two dimensional (complex) vectors" << std::endl; - - mm::vec2<std::complex<float>> j {{1, 2}, {3, -1}}; - mm::vec2<std::complex<float>> k { 5, {-2, 1}}; - - std::cout << "j = " << j << std::endl; - std::cout << "k = " << k << std::endl; - std::cout << std::endl; - - std::cout << "j x k = " << mm::vec2<std::complex<float>>::cross(j, k) << std::endl; - std::cout << "angle(j) = " << j.angle() << std::endl; - std::cout << "polar(j) = " << j.polar() << std::endl; - std::cout << std::endl; - - j *= 10; - - return 0; -} |