<commit_before>/**
 * 
 */
package org.xbig.test.t50;

import org.junit.Assert;
import org.junit.Test;
import org.xbig.base.ShortPointer;
import org.xbig.base.WideStringPointer;
import org.xbig.Ogre.A;
import org.xbig.std.ofstream;
import org.xbig.std.ifstream;
import org.xbig.std.ios.fmtflags;
import java.io.File;
/**
 * @author nenning
 *
 */
public class BasicTests {
	
	@Test
	public void passCppIOstreams() {
        A a = new A();
        ofstream oFile = new ofstream();
        ifstream iFile = new ifstream();

        a.dump(oFile);
        a.a(iFile);
        a.b(fmtflags.dec);

        iFile.delete();
        oFile.delete();
        a.delete();
	}

    @Test
    public void useCppFileIO() {
        ofstream oFile = new ofstream();
        ifstream iFile = new ifstream();

        String filename = "test.txt";
        short s = 'A';
        ShortPointer sPtr = new ShortPointer((short)0);

        oFile.open(filename);
        oFile.put(s);
        oFile.close();

        iFile.open(filename);
        iFile.get(sPtr);
        iFile.close();

        System.out.println("got from file: " + sPtr.get());
        File javaFile = new File(filename);
        javaFile.delete();
        Assert.assertEquals(s, sPtr.get());

        sPtr.delete();
        iFile.delete();
        oFile.delete();
    }

    @Test
    public void wstring() {
        A a = new A();
        String string = "<NAME>";
        WideStringPointer wstrPtr = new WideStringPointer(string);

        Assert.assertEquals(string, a.wstringValue(string));
        Assert.assertEquals(string, a.wstringPointer(wstrPtr).get());
        Assert.assertEquals(string, a.wstringReference(wstrPtr).get());<commit_msg>updated t50 to new API<commit_after>/**
 * 
 */
package org.xbig.test.t50;

import org.junit.Assert;
import org.junit.Test;
import org.xbig.base.BytePointer;
import org.xbig.base.WideStringPointer;
import org.xbig.Ogre.A;
import org.xbig.std.ofstream;
import org.xbig.std.ifstream;
import org.xbig.std.ios.fmtflags;
import java.io.File;
/**
 * @author nenning
 *
 */
public class BasicTests {
	
	@Test
	public void passCppIOstreams() {
        A a = new A();
        ofstream oFile = new ofstream();
        ifstream iFile = new ifstream();

        a.dump(oFile);
        a.a(iFile);
        a.b(fmtflags.dec);

        iFile.delete();
        oFile.delete();
        a.delete();
	}

    @Test
    public void useCppFileIO() {
        ofstream oFile = new ofstream();
        ifstream iFile = new ifstream();

        String filename = "test.txt";
        short s = 'A'; // = 65 in ascii
        BytePointer bytePtr = new BytePointer((byte)0);

        oFile.open(filename);
        oFile.put(s);
        oFile.close();

        iFile.open(filename);
        iFile.get(bytePtr);
        iFile.close();

        System.out.println("got from file: " + bytePtr.get() + ", as char: " + (char)(bytePtr.get().byteValue()));
        File javaFile = new File(filename);
        javaFile.delete();
        Assert.assertEquals(s, (short)bytePtr.get());

        bytePtr.delete();
        iFile.delete();
        oFile.delete();
    }

    @Test
    public void wstring() {
        A a = new A();
        String string = "Bulldozer Frenzy";
        WideStringPointer wstrPtr = new WideStringPointer(string);

        Assert.assertEquals(string, a.wstringValue(string));
        Assert.assertEquals(string, a.wstringPointer(wstrPtr).get());
        Assert.assertEquals(string, a.wstringReference(wstrPtr).get());
{'fraction_non_alphanumeric': 0.1415903890160183, 'fraction_numerical': 0.002860411899313501, 'mean_word_length': 2.3885658914728682, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6541955', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1116, 'n_words': 232}