From 44e70eca283d006c6a2ec33fd78b8a55fb5c46a7 Mon Sep 17 00:00:00 2001 From: ancarola Date: Tue, 5 Feb 2019 13:56:01 +0100 Subject: Test directory creation --- example.cpp | 62 -------------------------------------------------------- test/example.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 example.cpp create mode 100644 test/example.cpp diff --git a/example.cpp b/example.cpp deleted file mode 100644 index 3a00f58..0000000 --- a/example.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "mmvec.hpp" - -#include -#include - -int main(int argc, char *argv[]) { - // N dimensional vectors - std::cout << "N dimensional (int) vectors" << std::endl; - mm::vec u {3, 2, 1, 0, 1}; - mm::vec 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 a {1, 2, 3}; - mm::vec3 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::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> j {{1, 2}, {3, -1}}; - mm::vec2> 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>::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; -} diff --git a/test/example.cpp b/test/example.cpp new file mode 100644 index 0000000..3a00f58 --- /dev/null +++ b/test/example.cpp @@ -0,0 +1,62 @@ +#include "mmvec.hpp" + +#include +#include + +int main(int argc, char *argv[]) { + // N dimensional vectors + std::cout << "N dimensional (int) vectors" << std::endl; + mm::vec u {3, 2, 1, 0, 1}; + mm::vec 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 a {1, 2, 3}; + mm::vec3 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::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> j {{1, 2}, {3, -1}}; + mm::vec2> 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>::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; +} -- cgit v1.2.1