forked from ulysses4ever/cs211-extra-task-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (39 loc) · 1.84 KB
/
main.cpp
File metadata and controls
48 lines (39 loc) · 1.84 KB
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
40
41
42
43
44
45
46
47
48
#include <iostream>
#include "Header.h"
#include <assert.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUSSIAN");
assert(seconds_difference(1800.0, 3600.0) - 1800.0 < DBL_EPSILON);
assert(seconds_difference(3600.0, 1800.0) - (-1800.0) < DBL_EPSILON);
assert(seconds_difference(1800.0, 2160.0) - 360.0 < DBL_EPSILON);
assert(seconds_difference(1800.0, 1800.0) - 0.0 < DBL_EPSILON);
assert(hours_difference(1800.0, 3600.0) - 0.5 < DBL_EPSILON);
assert(hours_difference(3600.0, 1800.0) - (-0.5) < DBL_EPSILON);
assert(hours_difference(1800.0, 2160.0) - 0.1 < DBL_EPSILON);
assert(hours_difference(1800.0, 1800.0) - 0.0 < DBL_EPSILON);
assert(to_float_hours(0, 15, 0) - 0.25 < DBL_EPSILON);
assert(to_float_hours(2, 45, 9) - 2.7525 < DBL_EPSILON);
assert(to_float_hours(1, 0, 36) - 1.01 < DBL_EPSILON);
cout << to_24_hour_clock(25) << endl;
cout << to_24_hour_clock(24) << endl;
cout << to_24_hour_clock(48) << endl;
cout << to_24_hour_clock(4) << endl;
cout << to_24_hour_clock(28.5) << endl;
assert(fabs(time_to_utc(+0, 12.0) - 12.0) < DBL_EPSILON);
assert(fabs(time_to_utc(+1, 12.0) - 11.0) < DBL_EPSILON);
assert(fabs(time_to_utc(-1, 12.0) - 13.0) < DBL_EPSILON);
assert(fabs(time_to_utc(-11, 18.0) - 5.0) < DBL_EPSILON);
assert(fabs(time_to_utc(-1, 0.0) - 1.0) < DBL_EPSILON);
assert(fabs(time_to_utc(-1, 23.0) - 0.0) < DBL_EPSILON);
assert(fabs(time_from_utc(+0, 12.0) - 12.0) < DBL_EPSILON);
assert(fabs(time_from_utc(+1, 12.0) - 13.0) < DBL_EPSILON);
assert(fabs(time_from_utc(-1, 12.0) - 11.0) < DBL_EPSILON);
assert(fabs(time_from_utc(+6, 6.0) - 12.0) < DBL_EPSILON);
assert(fabs(time_from_utc(-7, 6.0) - 23.0) < DBL_EPSILON);
assert(fabs(time_from_utc(-1, 0.0) - 23.0) < DBL_EPSILON);
assert(fabs(time_from_utc(-1, 23.0) - 22.0) < DBL_EPSILON);
assert(fabs(time_from_utc(+1, 23.0) - 0.0) < DBL_EPSILON);
system("pause");
}