use of java.time.ZoneOffset in project j2objc by google.
the class TCKZoneOffset method test_constant_MIN.
@Test
public void test_constant_MIN() {
ZoneOffset test = ZoneOffset.MIN;
doTestOffset(test, -18, 0, 0);
}
use of java.time.ZoneOffset in project j2objc by google.
the class TCKZoneOffset method test_getTotalSeconds.
// -----------------------------------------------------------------------
// getTotalSeconds()
// -----------------------------------------------------------------------
@Test
public void test_getTotalSeconds() {
ZoneOffset offset = ZoneOffset.ofTotalSeconds(60 * 60 + 1);
assertEquals(offset.getTotalSeconds(), 60 * 60 + 1);
}
use of java.time.ZoneOffset in project j2objc by google.
the class TCKZoneOffset method test_factory_string_hours.
@Test
public void test_factory_string_hours() {
for (int i = -18; i <= 18; i++) {
String str = (i < 0 ? "-" : "+") + Integer.toString(Math.abs(i) + 100).substring(1);
ZoneOffset test = ZoneOffset.of(str);
doTestOffset(test, i, 0, 0);
}
}
use of java.time.ZoneOffset in project j2objc by google.
the class TCKZoneOffset method test_factory_string_UTC.
// -----------------------------------------------------------------------
// of(String)
// -----------------------------------------------------------------------
@Test
public void test_factory_string_UTC() {
String[] values = new String[] { "Z", "+0", "+00", "+0000", "+00:00", "+000000", "+00:00:00", "-00", "-0000", "-00:00", "-000000", "-00:00:00" };
for (int i = 0; i < values.length; i++) {
ZoneOffset test = ZoneOffset.of(values[i]);
assertSame(test, ZoneOffset.UTC);
}
}
use of java.time.ZoneOffset in project j2objc by google.
the class TCKZoneOffset method test_factory_int_hours_minutes_seconds.
// -----------------------------------------------------------------------
@Test
public void test_factory_int_hours_minutes_seconds() {
for (int i = -17; i <= 17; i++) {
for (int j = -59; j <= 59; j++) {
for (int k = -59; k <= 59; k++) {
if ((i < 0 && j <= 0 && k <= 0) || (i > 0 && j >= 0 && k >= 0) || (i == 0 && ((j < 0 && k <= 0) || (j > 0 && k >= 0) || j == 0))) {
ZoneOffset test = ZoneOffset.ofHoursMinutesSeconds(i, j, k);
doTestOffset(test, i, j, k);
}
}
}
}
ZoneOffset test1 = ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0);
doTestOffset(test1, -18, 0, 0);
ZoneOffset test2 = ZoneOffset.ofHoursMinutesSeconds(18, 0, 0);
doTestOffset(test2, 18, 0, 0);
}
Aggregations