View Javadoc
1   /*
2    * Copyright 2007-2015 Kasper B. Graversen
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  
17  package org.supercsv.datacreators;
18  
19  import java.io.FileWriter;
20  import java.io.IOException;
21  
22  import org.junit.Ignore;
23  import org.junit.Test;
24  import org.supercsv.io.CsvListWriter;
25  import org.supercsv.prefs.CsvPreference;
26  
27  /** Create data for performance tests */
28  public class SparseDataCreator {
29  
30  	@Ignore("This is a test only for convenience")
31  	@Test
32  	public void CreateSparseNumericData() throws IOException
33  	{
34  		FileWriter f = new FileWriter("SparseNumbersOnly.csv"); 
35  		CsvListWriter ff = new CsvListWriter(f, CsvPreference.STANDARD_PREFERENCE);
36  		
37  		final int rowsToProduce = 1000000;
38  		int j = 33;
39  		for(int i = 0; i < rowsToProduce; i++)
40  		{
41  			if(j == 0) j = 2;
42  			ff.write(i, i*j, i/(double)j);
43  			j = i*j % 1843;
44  		}
45  		ff.close();
46  	}
47  }