|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
1 | 20 | package org.apache.sysds.test.component.utils; |
2 | 21 |
|
3 | 22 | import static org.junit.Assert.assertEquals; |
|
6 | 25 | import org.junit.Test; |
7 | 26 |
|
8 | 27 | public class IOUtilsTest { |
9 | | - |
10 | 28 |
|
11 | | - @Test |
12 | | - public void getTo(){ |
| 29 | + @Test |
| 30 | + public void getTo() { |
13 | 31 | String in = ",\"yyy\"·4,"; |
14 | 32 | assertEquals(0, getTo(in, 0, ",")); |
15 | 33 | assertEquals(8, getTo(in, 1, ",")); |
16 | 34 | assertEquals("\"yyy\"·4", in.substring(1, getTo(in, 1, ","))); |
17 | 35 | } |
18 | 36 |
|
19 | | - @Test |
20 | | - public void getTo2(){ |
| 37 | + @Test |
| 38 | + public void getTo2() { |
21 | 39 | String in = ",y,"; |
22 | | - assertEquals(0,getTo(in, 0, ",")); |
23 | | - assertEquals(2,getTo(in, 1, ",")); |
| 40 | + assertEquals(0, getTo(in, 0, ",")); |
| 41 | + assertEquals(2, getTo(in, 1, ",")); |
24 | 42 | } |
25 | 43 |
|
26 | | - @Test |
27 | | - public void getTo3(){ |
| 44 | + @Test |
| 45 | + public void getTo3() { |
28 | 46 | String in = "a,b,c"; |
29 | | - assertEquals("a",in.substring(0,getTo(in, 0, ","))); |
30 | | - assertEquals("b",in.substring(2,getTo(in, 2, ","))); |
31 | | - assertEquals("c",in.substring(4,getTo(in, 4, ","))); |
| 47 | + assertEquals("a", in.substring(0, getTo(in, 0, ","))); |
| 48 | + assertEquals("b", in.substring(2, getTo(in, 2, ","))); |
| 49 | + assertEquals("c", in.substring(4, getTo(in, 4, ","))); |
32 | 50 | } |
33 | 51 |
|
34 | | - @Test |
35 | | - public void getTo4(){ |
| 52 | + @Test |
| 53 | + public void getTo4() { |
36 | 54 | String in = "a,\",\",c"; |
37 | | - assertEquals("a",in.substring(0,getTo(in, 0, ","))); |
38 | | - assertEquals("\",\"",in.substring(2,getTo(in, 2, ","))); |
| 55 | + assertEquals("a", in.substring(0, getTo(in, 0, ","))); |
| 56 | + assertEquals("\",\"", in.substring(2, getTo(in, 2, ","))); |
39 | 57 | } |
40 | 58 |
|
41 | | - private int getTo(String in, int from, String delim){ |
| 59 | + private int getTo(String in, int from, String delim) { |
42 | 60 | return IOUtilFunctions.getTo(in, from, ",", in.length(), 1); |
43 | 61 | } |
44 | 62 | } |
0 commit comments