Skip to content

Commit 263625d

Browse files
committed
Add tests
1 parent ba89e35 commit 263625d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
'test_type': 'runtime',
3+
'output': """
4+
result: 0
5+
__timestamp.amx returns 0
6+
""",
7+
'should_fail': False
8+
}

source/compiler/tests/__timestamp.pwn

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <console>
2+
#include <string>
3+
4+
main()
5+
{
6+
new day_seconds = __timestamp % (60 * 60 * 24);
7+
new hour = day_seconds / (60 * 60);
8+
new minute = (day_seconds % (60 * 60)) / 60;
9+
new second = day_seconds % 60;
10+
new buf[9];
11+
strformat(buf, _, _, "%02d:%02d:%02d", hour, minute, second);
12+
printf("result: %d\n", strcmp(buf, __time));
13+
}

0 commit comments

Comments
 (0)