Skip to content

Commit f4ae1f8

Browse files
committed
add test code
1 parent ff4c704 commit f4ae1f8

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

test_Code/code_generator_test-5.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int main() {
2+
time ti = 10:23:14;
3+
4+
write(getHour(ti));
5+
lf();
6+
7+
write(ti);
8+
}

test_Code/code_generator_test-6.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int main() {
2+
char t = 'c';
3+
4+
write(t);
5+
}

test_Code/code_generator_test-7.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int main() {
2+
date ti = 2015.05.30;
3+
4+
write(getDay(ti));
5+
lf();
6+
7+
write(ti);
8+
}

test_Code/code_generator_test-8.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
int main() {
2+
int n = -20150560;
3+
int day, month, year, tmp;
4+
int arr[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
5+
6+
read(&n);
7+
8+
year = n / 10000;
9+
day = n % 100;
10+
month = n % 10000 / 100;
11+
12+
year += month / 12;
13+
month %= 12;
14+
15+
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
16+
arr[1] = 29;
17+
}
18+
19+
tmp = arr[month - 1];
20+
month += day / tmp;
21+
year += month / 12;
22+
month %= 12;
23+
day %= tmp;
24+
25+
n = year * 10000 + month * 100 + day;
26+
27+
write(n);
28+
29+
return n;
30+
}

0 commit comments

Comments
 (0)