111
112 private static void check(String val, long expected) {
113 long n = Long.parseLong(val);
114 if (n != expected)
115 throw new RuntimeException("Long.parseLong failed. String:" +
116 val + " Result:" + n);
117 }
118
119 private static void checkFailure(String val) {
120 long n = 0L;
121 try {
122 n = Long.parseLong(val);
123 System.err.println("parseLong(" + val + ") incorrectly returned " + n);
124 throw new RuntimeException();
125 } catch (NumberFormatException nfe) {
126 ; // Expected
127 }
128 }
129
130 private static void checkNumberFormatException(String val, int radix, int start) {
131 int n = 0;
132 try {
133 n = Integer.parseInt(val, radix, start);
134 System.err.println("parseInt(" + val + ", " + radix + ", " + start +
135 ") incorrectly returned " + n);
136 throw new RuntimeException();
137 } catch (NumberFormatException nfe) {
138 ; // Expected
139 }
140 }
141
142 private static void checkNumberFormatException(String val, int radix, int start, int end) {
143 long n = 0;
144 try {
145 n = Long.parseLong(val, radix, start, end);
146 System.err.println("parseInt(" + val + ", " + radix + ", " + start + ", " + end +
147 ") incorrectly returned " + n);
148 throw new RuntimeException();
149 } catch (NumberFormatException nfe) {
150 ; // Expected
151 }
152 }
153
154 private static void checkIndexOutOfBoundsException(String val, int radix, int start) {
155 int n = 0;
156 try {
157 n = Integer.parseInt(val, radix, start);
158 System.err.println("parseInt(" + val + ", " + radix + ", " + start +
159 ") incorrectly returned " + n);
160 throw new RuntimeException();
161 } catch (IndexOutOfBoundsException ioob) {
162 ; // Expected
163 }
164 }
165
166 private static void checkIndexOutOfBoundsException(String val, int radix, int start, int end) {
167 long n = 0;
168 try {
169 n = Long.parseLong(val, radix, start, end);
170 System.err.println("parseInt(" + val + ", " + radix + ", " + start + ", " + end +
171 ") incorrectly returned " + n);
172 throw new RuntimeException();
173 } catch (IndexOutOfBoundsException ioob) {
174 ; // Expected
175 }
176 }
177
178 private static void checkNull(int radix, int start, int end) {
179 long n = 0;
180 try {
181 n = Long.parseLong(null, 10, start, end);
182 System.err.println("parseInt(null, " + radix + ", " + start + ", " + end +
183 ") incorrectly returned " + n);
184 throw new RuntimeException();
185 } catch (NullPointerException npe) {
186 ; // Expected
187 }
188 }
189
190 private static void check(String val, long expected, int start, int end) {
191 long n = Long.parseLong(val, 10, start, end);
192 if (n != expected)
193 throw new RuntimeException("Long.parseLong failed. String:" +
194 val + ", start: " + start + ", end: " + end + " Result:" + n);
195 }
196 }
|
111
112 private static void check(String val, long expected) {
113 long n = Long.parseLong(val);
114 if (n != expected)
115 throw new RuntimeException("Long.parseLong failed. String:" +
116 val + " Result:" + n);
117 }
118
119 private static void checkFailure(String val) {
120 long n = 0L;
121 try {
122 n = Long.parseLong(val);
123 System.err.println("parseLong(" + val + ") incorrectly returned " + n);
124 throw new RuntimeException();
125 } catch (NumberFormatException nfe) {
126 ; // Expected
127 }
128 }
129
130 private static void checkNumberFormatException(String val, int radix, int start) {
131 long n = 0;
132 try {
133 n = Long.parseLong(val, radix, start);
134 System.err.println("parseLong(" + val + ", " + radix + ", " + start +
135 ") incorrectly returned " + n);
136 throw new RuntimeException();
137 } catch (NumberFormatException nfe) {
138 ; // Expected
139 }
140 }
141
142 private static void checkNumberFormatException(String val, int radix, int start, int end) {
143 long n = 0;
144 try {
145 n = Long.parseLong(val, radix, start, end);
146 System.err.println("parseLong(" + val + ", " + radix + ", " + start + ", " + end +
147 ") incorrectly returned " + n);
148 throw new RuntimeException();
149 } catch (NumberFormatException nfe) {
150 ; // Expected
151 }
152 }
153
154 private static void checkIndexOutOfBoundsException(String val, int radix, int start) {
155 long n = 0;
156 try {
157 n = Long.parseLong(val, radix, start);
158 System.err.println("parseLong(" + val + ", " + radix + ", " + start +
159 ") incorrectly returned " + n);
160 throw new RuntimeException();
161 } catch (IndexOutOfBoundsException ioob) {
162 ; // Expected
163 }
164 }
165
166 private static void checkIndexOutOfBoundsException(String val, int radix, int start, int end) {
167 long n = 0;
168 try {
169 n = Long.parseLong(val, radix, start, end);
170 System.err.println("parseLong(" + val + ", " + radix + ", " + start + ", " + end +
171 ") incorrectly returned " + n);
172 throw new RuntimeException();
173 } catch (IndexOutOfBoundsException ioob) {
174 ; // Expected
175 }
176 }
177
178 private static void checkNull(int radix, int start, int end) {
179 long n = 0;
180 try {
181 n = Long.parseLong(null, 10, start, end);
182 System.err.println("parseLong(null, " + radix + ", " + start + ", " + end +
183 ") incorrectly returned " + n);
184 throw new RuntimeException();
185 } catch (NullPointerException npe) {
186 ; // Expected
187 }
188 }
189
190 private static void check(String val, long expected, int start, int end) {
191 long n = Long.parseLong(val, 10, start, end);
192 if (n != expected)
193 throw new RuntimeException("Long.parseLong failed. String:" +
194 val + ", start: " + start + ", end: " + end + " Result:" + n);
195 }
196 }
|