<commit_before>package latis.ops

import org.junit.Assert.assertEquals
import org.junit.Assert.fail
import org.junit.Test
import latis.dm.TestDataset
import latis.writer.AsciiWriter
import latis.dm.Dataset

class TestTotal {
  
  @Test
  def canonical {
    try{
      val ds = Total()(TestDataset.canonical)
      fail("Total should have failed on Text Variable")
    }
    catch{
      case _: UnsupportedOperationException => //test passed
    }
  }
  
  @Test
  def function_of_scalars {
    val ds = Total()(TestDataset.function_of_named_scalar)
    val data = ds.toStrings
    assertEquals(2, data.length)
    assertEquals(1, data(0).length)
    assertEquals("2.0", data(0)(0))
    assertEquals("3.0", data(1)(0))
  }

}<commit_msg>project on canonical ds before testing<commit_after>package latis.ops

import org.junit.Assert.assertEquals
import org.junit.Assert.fail
import org.junit.Test
import latis.dm.TestDataset
import latis.writer.AsciiWriter
import latis.dm.Dataset

class TestTotal {
  
  @Test
  def canonical {
    try{
      val ds = Total()(TestDataset.canonical)
      fail("Total should have failed on Text Variable")
    }
    catch{
      case _: UnsupportedOperationException => //test passed
    }
  }
  
  @Test
  def project_canonical {
    val ds = Total()(Projection(Seq("myTime", "myInt", "myReal"))(TestDataset.canonical))
    val data = ds.toStrings
    assertEquals(1, data(0).length)
    assertEquals("6.6", data(2)(0))
    assertEquals("6.0", data(1)(0))
    assertEquals("1970/01/03", data(0)(0))
  }
  
  @Test
  def function_of_scalars {
    val ds = Total()(TestDataset.function_of_named_scalar)
    val data = ds.toStrings
    assertEquals(2, data.length)
    assertEquals(1, data(0).length)
    assertEquals("2.0", data(0)(0))
    assertEquals("3.0", data(1)(0))
  }

}
{'fraction_non_alphanumeric': 0.12589729431253452, 'fraction_numerical': 0.02319160684704583, 'mean_word_length': 3.496277915632754, 'pattern_counts': {'":': 0, '<': 3, '<?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': '660389', 'n_tokens_mistral': 606, 'n_tokens_neox': 600, 'n_words': 128}