/**
 * Copyright (C) 2010-12 Brookhaven National Laboratory All rights reserved. Use
 * is subject to license terms.
 */
package org.epics.vtype.io;

import java.io.StringWriter;
import org.epics.util.time.Timestamp;
import org.epics.vtype.VNumber;
import org.epics.vtype.ValueFactory;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import static org.epics.vtype.ValueFactory.*;
import static org.epics.vtype.ValueUtil.*;

/**
 *
 * @author carcassi
 */
public class CSVIOTest {
    
    public CSVIOTest() {
    }

    @Test
    public void exportVNumber() {
        VNumber value = ValueFactory.newVDouble(1.0, newTime(Timestamp.of(0, 0)));
        
        CSVIO io = new CSVIO();
        assertThat(io.canExport(value), equalTo(true));
        StringWriter writer = new StringWriter();
        io.export(value, writer);
        System.out.println(writer.toString());
        assertThat(writer.toString(), equalTo("\"1969/12/31 19:00:00.0 -0500\" NONE NONE 1.0"));
    }
}
@@ -627,22 +627,23 @@
 tVNumber
+1
 () %7B%0D%0A
-
         
@@ -722,18 +722,8 @@
 );%0D%0A
-        %0D%0A
     
@@ -747,24 +747,471 @@
 w CSVIO();%0D%0A
+        exportTest(io, value, %22%5C%221969/12/31 19:00:00.0 -0500%5C%22 NONE NONE 1.0%22);%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void exportVNumber2() %7B%0D%0A        VNumber value = ValueFactory.newVInt(10, alarmNone(), newTime(Timestamp.of(90, 0)), displayNone());%0D%0A        CSVIO io = new CSVIO();%0D%0A        exportTest(io, value, %22%5C%221969/12/31 19:01:30.0 -0500%5C%22 NONE NONE 10.0%22);%0D%0A    %7D%0D%0A    %0D%0A    public static void exportTest(CSVIO io, Object value, String csv) %7B%0D%0A
         asse
@@ -1439,55 +1439,11 @@
 lTo(
-%22%5C%221969/12/31 19:00:00.0 -0500%5C%22 NONE NONE 1.0%22
+csv
 ));%0D

refactor io tests