summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-01-15 14:22:10 -0800
committerKenny Root <kroot@google.com>2010-01-15 14:23:20 -0800
commitde8aa87016a8dc2c252002ec60f6285b7a839336 (patch)
tree2fdb2899cff26735ef901fe455d6961ab5e60238 /tests
parent93aea69649c2ac163db3333563644d2593f2770c (diff)
downloadframeworks_base-de8aa87016a8dc2c252002ec60f6285b7a839336.zip
frameworks_base-de8aa87016a8dc2c252002ec60f6285b7a839336.tar.gz
frameworks_base-de8aa87016a8dc2c252002ec60f6285b7a839336.tar.bz2
Update Time.parse3339() unit tests
Month should be n-1 from input and timezone is already normalized to UTC. Change-Id: I030c6444f92b96f85acea81f1675edf061bb5451
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidTests/src/com/android/unit_tests/TimeTest.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TimeTest.java b/tests/AndroidTests/src/com/android/unit_tests/TimeTest.java
index 3b33a99..724ef6a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TimeTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/TimeTest.java
@@ -359,56 +359,58 @@ public class TimeTest extends TestCase {
Time t = new Time(Time.TIMEZONE_UTC);
t.parse3339("1980-05-23");
- if (!t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23) {
+ if (!t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23) {
fail("Did not parse all-day date correctly");
}
t.parse3339("1980-05-23T09:50:50");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
t.hour != 9 || t.minute != 50 || t.second != 50 ||
t.gmtoff != 0) {
fail("Did not parse timezone-offset-less date correctly");
}
t.parse3339("1980-05-23T09:50:50Z");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
t.hour != 9 || t.minute != 50 || t.second != 50 ||
t.gmtoff != 0) {
fail("Did not parse UTC date correctly");
}
t.parse3339("1980-05-23T09:50:50.0Z");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
t.hour != 9 || t.minute != 50 || t.second != 50 ||
t.gmtoff != 0) {
fail("Did not parse UTC date correctly");
}
t.parse3339("1980-05-23T09:50:50.12Z");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
t.hour != 9 || t.minute != 50 || t.second != 50 ||
t.gmtoff != 0) {
fail("Did not parse UTC date correctly");
}
t.parse3339("1980-05-23T09:50:50.123Z");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
t.hour != 9 || t.minute != 50 || t.second != 50 ||
t.gmtoff != 0) {
fail("Did not parse UTC date correctly");
}
- t.parse3339("1980-05-23T09:50:50-06:00");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
- t.hour != 9 || t.minute != 50 || t.second != 50 ||
- t.gmtoff != -6*3600) {
+ // The time should be normalized to UTC
+ t.parse3339("1980-05-23T09:50:50-01:05");
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
+ t.hour != 10 || t.minute != 55 || t.second != 50 ||
+ t.gmtoff != 0) {
fail("Did not parse timezone-offset date correctly");
}
- t.parse3339("1980-05-23T09:50:50.123-06:00");
- if (t.allDay || t.year != 1980 || t.month != 05 || t.monthDay != 23 ||
- t.hour != 9 || t.minute != 50 || t.second != 50 ||
- t.gmtoff != -6*3600) {
+ // The time should be normalized to UTC
+ t.parse3339("1980-05-23T09:50:50.123-01:05");
+ if (t.allDay || t.year != 1980 || t.month != 04 || t.monthDay != 23 ||
+ t.hour != 10 || t.minute != 55 || t.second != 50 ||
+ t.gmtoff != 0) {
fail("Did not parse timezone-offset date correctly");
}