rt/emul/brwsrtest/src/test/java/org/apidesign/bck2brwsr/brwsrtest/TimeZoneTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 20 May 2016 06:02:44 +0200
changeset 1963 4b7ef2a05eb7
parent 1945 rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck/TimerTest.java@a139403de819
permissions -rw-r--r--
Trivial implementation of TimeZone.getDefault() - doesn't count with daylightsavings
jaroslav@1407
     1
/**
jaroslav@1407
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1787
     3
 * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@1407
     4
 *
jaroslav@1407
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@1407
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@1407
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@1407
     8
 *
jaroslav@1407
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@1407
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@1407
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@1407
    12
 * GNU General Public License for more details.
jaroslav@1407
    13
 *
jaroslav@1407
    14
 * You should have received a copy of the GNU General Public License
jaroslav@1407
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@1407
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@1407
    17
 */
jaroslav@1963
    18
package org.apidesign.bck2brwsr.brwsrtest;
jaroslav@1407
    19
jaroslav@1963
    20
import java.util.TimeZone;
jaroslav@1963
    21
import org.apidesign.bck2brwsr.vmtest.Compare;
jaroslav@1407
    22
import org.apidesign.bck2brwsr.vmtest.VMTest;
jaroslav@1407
    23
import org.testng.annotations.Factory;
jaroslav@1407
    24
jaroslav@1407
    25
/**
jaroslav@1407
    26
 *
jaroslav@1407
    27
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@1407
    28
 */
jaroslav@1963
    29
public class TimeZoneTest {
jaroslav@1945
    30
    boolean started;
jaroslav@1407
    31
    int miss;
jaroslav@1407
    32
    int exec;
jaroslav@1407
    33
    
jaroslav@1963
    34
    public TimeZoneTest() {
jaroslav@1407
    35
    }
jaroslav@1407
    36
    
jaroslav@1963
    37
    @Compare
jaroslav@1963
    38
    public int defaultTimeZoneRawOffset() throws Exception {
jaroslav@1963
    39
        TimeZone zone = TimeZone.getDefault();
jaroslav@1963
    40
        assert zone != null : "TimeZone.getDefault shouldn't be null";
jaroslav@1963
    41
        int offset = zone.getRawOffset();
jaroslav@1963
    42
        if (offset > 0) {
jaroslav@1963
    43
            return 1;
jaroslav@1963
    44
        } else if (offset < 0) {
jaroslav@1963
    45
            return -1;
jaroslav@1963
    46
        } else {
jaroslav@1963
    47
            return 0;
jaroslav@1407
    48
        }
jaroslav@1407
    49
    }
jaroslav@1407
    50
    
jaroslav@1407
    51
    @Factory public static Object[] create() {
jaroslav@1963
    52
        return VMTest.create(TimeZoneTest.class);
jaroslav@1407
    53
    }
jaroslav@1407
    54
    
jaroslav@1407
    55
}