<commit_before>package net.sf.pzfilereader.parserutils;

import java.util.List;

import net.sf.pzfilereader.util.ParserUtils;
import junit.framework.TestCase;
/**
 * Test misc methods in the ParserUtils
 * class
 * 
 * @author <NAME>
 */
public class ParserUtilsTest extends TestCase{
    
    public void testStripNonDouble(){
       checkDoubleStrip("  $10.00   ", "10.00");
       checkDoubleStrip("random chars  $10.00   more random", "10.00");
       checkDoubleStrip(" $ 1 0 . 0 0 ", "10.00");
       checkDoubleStrip("- $ 1 0 . 0 0 ", "-10.00");
       checkDoubleStrip("1a2b3c4d.01234", "1234.01234");
       checkDoubleStrip("-", "0");
       checkDoubleStrip("  -  ", "0");
       checkDoubleStrip("", "0");
    }
    
    private void checkDoubleStrip(final String txtToStrip, final String expected) {
        final String stripRes = ParserUtils.stripNonDoubleChars(txtToStrip);
        assertEquals("expecting...", stripRes, expected);
    }
    
    
    public void testStripNonLong(){
        checkLongStrip("  $10.00   ", "10");
        checkLongStrip("random chars  $10.00   more random", "10");
        checkLongStrip(" $ 1 0 . 0 0 ", "10");
        checkLongStrip("- $ 1 0 . 0 0 ", "-10");
        checkLongStrip("1a2b3c4d.01234", "1234");
        checkLongStrip("-", "0");
        checkLongStrip("  -  ", "0");
        checkLongStrip("", "0");
     }
     
     private void checkLongStrip(final String txtToStrip, final String expected) {
         final String stripRes = ParserUtils.stripNonLongChars(txtToStrip);
         assertEquals("expecting...", stripRes, expected);
     }
    
    
    public static void main(final String[] args) {
        junit.textui.TestRunner.run(ParserUtilsTest.class);
    }
}
<commit_msg>added some unit tests for pzconverter<commit_after>package net.sf.pzfilereader.parserutils;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Properties;

import net.sf.pzfilereader.util.ParserUtils;
import junit.framework.TestCase;
/**
 * Test misc methods in the ParserUtils
 * class
 * 
 * @author <NAME>
 */
public class ParserUtilsTest extends TestCase{
    
    public void testStripNonDouble(){
       checkDoubleStrip("  $10.00   ", "10.00");
       checkDoubleStrip("random chars  $10.00   more random", "10.00");
       checkDoubleStrip(" $ 1 0 . 0 0 ", "10.00");
       checkDoubleStrip("- $ 1 0 . 0 0 ", "-10.00");
       checkDoubleStrip("1a2b3c4d.01234", "1234.01234");
       checkDoubleStrip("-", "0");
       checkDoubleStrip("  -  ", "0");
       checkDoubleStrip("", "0");
    }
    
    private void checkDoubleStrip(final String txtToStrip, final String expected) {
        final String stripRes = ParserUtils.stripNonDoubleChars(txtToStrip);
        assertEquals("expecting...", stripRes, expected);
    }
    
    
    public void testStripNonLong(){
        checkLongStrip("  $10.00   ", "10");
        checkLongStrip("random chars  $10.00   more random", "10");
        checkLongStrip(" $ 1 0 . 0 0 ", "10");
        checkLongStrip("- $ 1 0 . 0 0 ", "-10");
        checkLongStrip("1a2b3c4d.01234", "1234");
        checkLongStrip("-", "0");
        checkLongStrip("  -  ", "0");
        checkLongStrip("", "0");
     }
     
     private void checkLongStrip(final String txtToStrip, final String expected) {
         final String stripRes = ParserUtils.stripNonLongChars(txtToStrip);
         assertEquals("expecting...", stripRes, expected);
     }
     
     public void testPZConverter() throws IOException{
         final Properties convertProps = ParserUtils.loadConvertProperties();
         
         assertEquals(ParserUtils.runPzConverter(convertProps, "$5.00C", Double.class), new Double("5.00"));
         assertEquals(ParserUtils.runPzConverter(convertProps, "$5.00C", Integer.class), new Integer("5"));
         assertEquals(ParserUtils.runPzConverter(convertProps, "$5.3556", BigDecimal.class), new BigDecimal("5.3556"));
     }
    
    
    public static void main(final String[] args) {
        junit.textui.TestRunner.run(ParserUtilsTest.class);
    }
}

{'fraction_non_alphanumeric': 0.13748810656517602, 'fraction_numerical': 0.04900095147478592, 'mean_word_length': 2.578723404255319, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1376441', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1300, 'n_words': 281}