-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht-abs.cc
41 lines (32 loc) · 1 KB
/
t-abs.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <limits>
#include <lvv/lvv.h>
#include <lvv/math.h>
using namespace std;
using namespace lvv;
///////////////////////////////////////////////////////////////////
int
main() {
setup_fpe();
cerr << setprecision(numeric_limits<double>::digits10+4) << boolalpha;
cout << setprecision(numeric_limits<double>::digits10+4) << boolalpha;
#include "../lvv/lvvcheck.h"
cout << "\n\n *** Test equal<integral>() ***\n";
cout << std::boolalpha;
CHECK(abs(1)==1);
CHECK(abs(1u)==1);
CHECK(abs((char)-1)==1);
CHECK(abs(1UL)==1);
CHECK(abs((long)-1)==1);
CHECK(abs(9999)==9999);
CHECK(abs(-31)==31);
CHECK(abs(0)==0);
CHECK(abs(1.0f)==1.f);
CHECK(abs(-1.f)==1.f);
CHECK(abs(-1.0)==1.);
CHECK(abs(-1E10l)==1E10);
CHECK(abs(9999)==9999);
CHECK(abs(-31.f)==31.f);
CHECK(abs(0.0f)==0.0);
cout << (all_pass ? "\n------------ all pass ------------\n" : "\n!!!!!!!!! SOME FAILED !!!!!!!!\n");
exit(all_pass ? 0 : 1);
}