1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package libcore.java.lang;
18
19public class ByteTest extends junit.framework.TestCase {
20    public void test_compare() throws Exception {
21        final byte min = Byte.MIN_VALUE;
22        final byte zero = (byte) 0;
23        final byte max = Byte.MAX_VALUE;
24        assertTrue(Byte.compare(max,  max)  == 0);
25        assertTrue(Byte.compare(min,  min)  == 0);
26        assertTrue(Byte.compare(zero, zero) == 0);
27        assertTrue(Byte.compare(max,  zero) > 0);
28        assertTrue(Byte.compare(max,  min)  > 0);
29        assertTrue(Byte.compare(zero, max)  < 0);
30        assertTrue(Byte.compare(zero, min)  > 0);
31        assertTrue(Byte.compare(min,  zero) < 0);
32        assertTrue(Byte.compare(min,  max)  < 0);
33    }
34
35    public void testStaticHashCode() {
36        assertEquals(new Byte((byte) 567).hashCode(), Byte.hashCode((byte) 567));
37    }
38
39    public void testBYTES() {
40        assertEquals(1, Byte.BYTES);
41    }
42}
43