BitSetTest.java revision 89c1feb0a69a7707b271086e749975b3f7acacf7
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18package org.apache.harmony.luni.tests.java.util;
19
20import dalvik.annotation.TestInfo;
21import dalvik.annotation.TestLevel;
22import dalvik.annotation.TestTarget;
23import dalvik.annotation.TestTargetClass;
24
25import junit.framework.TestCase;
26
27import java.util.BitSet;
28
29@TestTargetClass(BitSet.class)
30public class BitSetTest extends TestCase {
31
32    /**
33     * @tests java.util.BitSet#clear(int, int)
34     */
35    @TestInfo(
36      level = TestLevel.PARTIAL,
37      purpose = "IndexOutOfBoundsException is not verified.",
38      targets = {
39        @TestTarget(
40          methodName = "clear",
41          methodArgs = {int.class, int.class}
42        )
43    })
44    public void test_clearII() {
45        // Regression for HARMONY-98
46        BitSet bitset = new BitSet();
47        for (int i = 0; i < 20; i++) {
48            bitset.set(i);
49        }
50        bitset.clear(10, 10);
51    }
52
53    /**
54     * @tests java.util.BitSet#flip(int, int)
55     */
56    @TestInfo(
57      level = TestLevel.PARTIAL,
58      purpose = "IndexOutOfBoundsException is not verified.",
59      targets = {
60        @TestTarget(
61          methodName = "flip",
62          methodArgs = {int.class, int.class}
63        )
64    })
65    public void test_flipII() {
66        BitSet bitset = new BitSet();
67        for (int i = 0; i < 20; i++) {
68            bitset.set(i);
69        }
70        bitset.flip(10, 10);
71    }
72
73    /**
74     * @tests java.util.BitSet#get(int, int)
75     */
76    @TestInfo(
77      level = TestLevel.PARTIAL,
78      purpose = "IndexOutOfBoundsException is not verified.",
79      targets = {
80        @TestTarget(
81          methodName = "get",
82          methodArgs = {int.class, int.class}
83        )
84    })
85    public void test_getII() {
86        BitSet bitset = new BitSet(30);
87        bitset.get(3, 3);
88    }
89
90    /**
91     * @tests java.util.BitSet#set(int, int)
92     */
93    @TestInfo(
94      level = TestLevel.PARTIAL,
95      purpose = "IndexOutOfBoundsException is not verified.",
96      targets = {
97        @TestTarget(
98          methodName = "set",
99          methodArgs = {int.class, int.class}
100        )
101    })
102    public void test_setII() {
103        BitSet bitset = new BitSet(30);
104        bitset.set(29, 29);
105    }
106}
107