Skip to content

Commit 41f00d4

Browse files
committed
fix headers for portability
1 parent 604e1ce commit 41f00d4

File tree

5 files changed

+14
-136
lines changed

5 files changed

+14
-136
lines changed

SampleProjects/TestSomething/test/good-trig.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ unittest(floor)
1111

1212
unittest(cos)
1313
{
14-
assertEqual(1.0, (float)cos(0));
15-
assertLess(-0.01, (float)cos(3.141 / 2));
16-
assertMore(0.01, (float)cos(3.141 / 2));
17-
assertMore(-0.99, (float)cos(3.141));
18-
assertLess(-1.01, (float)cos(3.141));
14+
assertEqual(1.0, cos(0));
15+
assertLess(-0.01, cos(3.141 / 2));
16+
assertMore(0.01, cos(3.141 / 2));
17+
assertMore(-0.99, cos(PI));
18+
assertLess(-1.01, cos(PI));
19+
assertLess(-0.01, cos(radians(90)));
20+
assertMore(0.01, cos(radians(90)));
1921
}
2022

2123
unittest_main()

cpp/arduino/AvrMath.cpp

-111
This file was deleted.

cpp/arduino/AvrMath.h

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//#include <math.h>
21
#pragma once
2+
#include <math.h>
33

44
#define constrain(x,l,h) ((x)<(l)?(l):((x)>(h)?(h):(x)))
55
#define map(x,inMin,inMax,outMin,outMax) (((x)-(inMin))*((outMax)-(outMin))/((inMax)-(inMin))+outMin)
@@ -18,23 +18,10 @@
1818
#undef min
1919
#endif
2020
#define min(a,b) ((a)<(b)?(a):(b))
21-
float pow(float, float);
22-
#define sq(x) ((x)*(x))
23-
float sqrt(float);
2421

25-
// https://stackoverflow.com/a/26091248/2063546
26-
#define floor(x) ((x) < (int)(x) ? (int)(x) - 1 : (int)(x))
27-
#define ceil(x) (0-floor(-(x)))
28-
// https://stackoverflow.com/a/26342944/2063546
29-
#define fmod(a,b) ((a)-(b)*floor((a)/(b)))
22+
#define sq(x) ((x)*(x))
3023

3124
#define radians(deg) ((deg)*DEG_TO_RAD)
3225
#define degrees(rad) ((rad)*RAD_TO_DEG)
3326

3427

35-
// http://www.ganssle.com/approx.htm
36-
// http://www.ganssle.com/approx/sincos.cpp
37-
double cos(double);
38-
double sin(double);
39-
double tan(double);
40-

cpp/arduino/WString.h

-5
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ class String: public string
148148

149149
};
150150

151-
template <typename T> inline std::ostream& operator << ( std::ostream& out, const std::basic_string<T>& bs ) {
152-
out << bs.c_str();
153-
return out;
154-
}
155-
156151
inline std::ostream& operator << ( std::ostream& out, const String& bs ) {
157152
out << bs.c_str();
158153
return out;

cpp/unittest/Assertion.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#pragma once
2+
3+
#ifndef typeof
4+
#define typeof __typeof__
5+
#endif
6+
27
#include "Compare.h"
38

49
#define testBehaviorOp(die, desc, rel1, arg1, op, op_name, rel2, arg2) \

0 commit comments

Comments
 (0)