/** * Simple stress test for {@link DecimalOption} type. * @throws Exception if failed */ @Test public void stress_decimal() throws Exception { int count = 5000000; CsvConfiguration conf = createConfiguration(); try (RCReader reader = new RCReader("3.141592\r\n".getBytes(conf.getCharset()), count); CsvParser parser = new CsvParser(reader, "testing", conf)) { int rows = 0; DecimalOption date = new DecimalOption(); while (parser.next()) { parser.fill(date); parser.endRecord(); if (rows == 0) { assertThat(date, is(new DecimalOption(new BigDecimal("3.141592")))); } rows++; } assertThat(rows, is(count)); } }
/** * Simple stress test for {@link DateTime} type. * @throws Exception if failed */ @Test public void stress_datetime() throws Exception { int count = 5000000; CsvConfiguration conf = createConfiguration(); try (RCReader reader = new RCReader("1999-12-31 01:23:45\r\n".getBytes(conf.getCharset()), count); CsvParser parser = new CsvParser(reader, "testing", conf)) { int rows = 0; DateTimeOption date = new DateTimeOption(); while (parser.next()) { parser.fill(date); parser.endRecord(); if (rows == 0) { assertThat(date, is(new DateTimeOption(new DateTime(1999, 12, 31, 1, 23, 45)))); } rows++; } parser.close(); assertThat(rows, is(count)); } }
/** * Simple stress test for {@link Date} type. * @throws Exception if failed */ @Test public void stress_date() throws Exception { int count = 5000000; CsvConfiguration conf = createConfiguration(); try (RCReader reader = new RCReader("1999-12-31\r\n".getBytes(conf.getCharset()), count); CsvParser parser = new CsvParser(reader, "testing", conf)) { int rows = 0; DateOption date = new DateOption(); while (parser.next()) { parser.fill(date); parser.endRecord(); if (rows == 0) { assertThat(date, is(new DateOption(new Date(1999, 12, 31)))); } rows++; } parser.close(); assertThat(rows, is(count)); } }