<commit_before>package ohnosequences.stuff.test

import ohnosequences.stuff._, AnyFunction._, Sums._, Product._
import scala.{ Int, Boolean }
import scala.Predef.String
import org.scalatest.FunSuite

class Sums extends FunSuite {

  test("either") {

    val l       = function { x: String => x.length }
    val toStr   = function { x: Int => x.toString }
    val isZero  = function { x: Int => x == 0 }
    val isEmpty = function { x: String => x.isEmpty }

    assert {
      either(isZero × isEmpty)(inL(0)) == isZero(0)     &&
      either(isZero × isEmpty)(inR("")) == isEmpty("")
    }
  }<commit_msg>add a couple of sum tests<commit_after>package ohnosequences.stuff.test

import ohnosequences.stuff._, AnyFunction._, Product._, Scala._
import ohnosequences.stuff.{Sums => sums}, sums._
import scala.{ Int, Boolean }
import scala.Predef.String
import org.scalatest.FunSuite

class Sums extends FunSuite {

  test("either") {

    val l       = function { x: String => x.length }
    val toStr   = function { x: Int => x.toString }
    val isZero  = function { x: Int => x == 0 }
    val isEmpty = function { x: String => x.isEmpty }

    assert {
      either(isZero × isEmpty)(inL(0)) == isZero(0)     &&
      either(isZero × isEmpty)(inR("")) == isEmpty("")
    }
  }

  test("any nothing commutative monoid") {

    val l: String + String =
      inL("hola")

    val r: String + String =
      inR("scalac")

    assert {
      any(l) == (sums.swap >=> any[String])(l) &&
      any(r) == (sums.swap >=> any[String])(r)
    }
  }
{'fraction_non_alphanumeric': 0.15194805194805194, 'fraction_numerical': 0.003896103896103896, 'mean_word_length': 2.8333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '6406258', 'n_tokens_mistral': 550, 'n_tokens_neox': 521, 'n_words': 138}