<commit_before>package org.sterl.svg2png.config;
import static org.sterl.svg2png.AssertUtil.assertEndsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Test;
import org.sterl.svg2png.config.FileOutput;
import org.sterl.svg2png.config.OutputConfig;
import org.sterl.svg2png.util.FileUtil;

public class TestFileOutput {

    @Test
    public void testNaming() throws Exception {
        Path tmpDirFoooo = Files.createTempDirectory("Foooo");
        tmpDirFoooo.toFile().deleteOnExit();
        
        
        Path tmpDirBaaaar = Files.createTempDirectory("Baaaar");
        tmpDirBaaaar.toFile().deleteOnExit();

        OutputConfig cfg = OutputConfig.fromPath(getClass().getResource("/sample.svg").toString());
        assertEquals(1, cfg.getFiles().size());
        
        FileOutput outFile = cfg.getFiles().get(0);
        
        File srcFile = FileUtil.newFile(cfg.getInputFile());
        assertEquals("./sample.png".replace('/', File.separatorChar), outFile.toOutputFile(srcFile, ".", null).toString());
        assertEquals("/tmp/sample.png".replace('/', File.separatorChar), outFile.toOutputFile(srcFile, "/tmp", null).toString());<commit_msg>fixed unit test<commit_after>package org.sterl.svg2png.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.sterl.svg2png.AssertUtil.assertEndsWith;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Test;
import org.sterl.svg2png.util.FileUtil;

public class TestFileOutput {

    @Test
    public void testNaming() throws Exception {
        Path tmpDirFoooo = Files.createTempDirectory("Foooo");
        tmpDirFoooo.toFile().deleteOnExit();
        
        
        Path tmpDirBaaaar = Files.createTempDirectory("Baaaar");
        tmpDirBaaaar.toFile().deleteOnExit();

        OutputConfig cfg = OutputConfig.fromPath(getClass().getResource("/svgfolder/sample.svg").toString());
        assertEquals(1, cfg.getFiles().size());
        
        FileOutput outFile = cfg.getFiles().get(0);
        
        File srcFile = FileUtil.newFile(cfg.getInputFile());
        assertEquals("./sample.png".replace('/', File.separatorChar), outFile.toOutputFile(srcFile, ".", null).toString());
        assertEquals("/tmp/sample.png".replace('/', File.separatorChar), outFile.toOutputFile(srcFile, "/tmp", null).toString());
{'fraction_non_alphanumeric': 0.14007936507936508, 'fraction_numerical': 0.004761904761904762, 'mean_word_length': 3.774621212121212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3225082', 'n_tokens_mistral': 750, 'n_tokens_neox': 741, 'n_words': 121}