<commit_before>package rdg;

import utest.Assert;

class TestGenerators {
  public function new() { }

  function decimalsGenerator(step : Float) {
    var value = -step;
    return function()
    {
      value += step;
      if(value == 1)
        value = 0;
      return value;
    }
  }

  public function testInt( {
    var ints = new GInt(5, 10, decimalsGenerator(0.2));

    Assert.equals(5, ints.generate());
    Assert.equals(6, ints.generate());
    Assert.equals(7, ints.generate());
    Assert.equals(8, ints.generate());
    Assert.equals(9, ints.generate());
  }

  public function testPicker( {
    var pick = new GPicker(["a", "b", "c", "d"], decimalsGenerator(0.25));

    Assert.equals("a", pick.generate());
    Assert.equals("b", pick.generate());
    Assert.equals("c", pick.generate());
    Assert.equals("d", pick.generate());
  }

  public function testWeighterPicker( {
    var pick = new GWeighted(
      [
        { value : "a", weight : 1.0 },
        { value : "b", weight : 2.0 },
        { value : "c", weight : 3.0 },
        { value : "d", weight : 4.0 }
      ],
      function(item, _) return item.weight,
      decimalsGenerator(0.1));

    Assert.equals("a", pick.generate().value);
    Assert.equals("b", pick.generate().value);
    Assert.equals("b", pick.generate().value);
    Assert.equals("c", pick.generate().value);
    Assert.equals("c", pick.generate().value);
    Assert.equals("c", pick.generate().value);
    Assert.equals("d", pick.generate().value);
    Assert.equals("d", pick.generate().value);
    Assert.equals("d", pick.generate().value);
    Assert.equals("d", pick.generate().value);
  }<commit_msg>typos<commit_after>package rdg;

import utest.Assert;

class TestGenerators {
  public function new() { }

  function decimalsGenerator(step : Float) {
    var value = -step;
    return function()
    {
      value += step;
      if(value == 1)
        value = 0;
      return value;
    }
  }

  public function testInt() {
    var ints = new GInt(5, 10, decimalsGenerator(0.2));

    Assert.equals(5, ints.generate());
    Assert.equals(6, ints.generate());
    Assert.equals(7, ints.generate());
    Assert.equals(8, ints.generate());
    Assert.equals(9, ints.generate());
  }

  public function testPicker() {
    var pick = new GPicker(["a", "b", "c", "d"], decimalsGenerator(0.25));

    Assert.equals("a", pick.generate());
    Assert.equals("b", pick.generate());
    Assert.equals("c", pick.generate());
    Assert.equals("d", pick.generate());
  }

  public function testWeighterPicker() {
    var pick = new GWeighted(
      [
        { value : "a", weight : 1.0 },
        { value : "b", weight : 2.0 },
        { value : "c", weight : 3.0 },
        { value : "d", weight : 4.0 }
      ],
      function(item, _) return item.weight,
      decimalsGenerator(0.1));

    Assert.equals("a", pick.generate().value);
    Assert.equals("b", pick.generate().value);
    Assert.equals("b", pick.generate().value);
    Assert.equals("c", pick.generate().value);
    Assert.equals("c", pick.generate().value);
    Assert.equals("c", pick.generate().value);
    Assert.equals("d", pick.generate().value);
    Assert.equals("d", pick.generate().value);
    Assert.equals("d", pick.generate().value);
    Assert.equals("d", pick.generate().value);
  }
{'fraction_non_alphanumeric': 0.18948322756119673, 'fraction_numerical': 0.015110305228165609, 'mean_word_length': 2.9357907253269917, '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': '5419222', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1056, 'n_words': 220}