APM:Libraries
math_test.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Intel Corporation. All rights reserved.
3  *
4  * This file is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This file is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #pragma once
18 
19 #include <iostream>
20 
21 #include <AP_gtest.h>
22 #include <AP_Math/AP_Math.h>
23 
24 /*
25  * Overload operator << for AP_Math types to allow nice printing for failed
26  * tests.
27  */
28 
29 template <typename T>
30 ::std::ostream& operator<<(::std::ostream& os, const Matrix3<T>& m)
31 {
32  return os << "{{" << m.a.x << ", " << m.a.y << ", " << m.a.z << "}, " <<
33  "{" << m.b.x << ", " << m.b.y << ", " << m.b.z << "}, " <<
34  "{" << m.c.x << ", " << m.c.y << ", " << m.c.z << "}}";
35 }
36 
37 template <typename T>
38 ::std::ostream& operator<<(::std::ostream& os, const Vector3<T>& v)
39 {
40  return os << "{" << v.x << ", " << v.y << ", " << v.z << "}";
41 }
float v
Definition: Printf.cpp:15