<commit_before>package io.kotlintest.properties

import io.kotlintest.matchers.be
import io.kotlintest.matchers.have
import io.kotlintest.specs.WordSpec
import java.util.*

/**
 *  @author <NAME>
 */
class GenTest : WordSpec() {
    init {
        "Gen.string.nextPrintableString" should {
            "give out a argument long string" {
                val random = Random();
                var rand = random.nextInt(10000);
                if (rand <= 0)
                    rand = 0 - rand;

                Gen.string().nextPrintableString(rand).length shouldBe rand
            }.config(invocations = 100, threads = 8)
        }
        "Gen.choose<int, int>" should {
            "only give out numbers in the given range" {
                val random = Random();

                val max = random.nextInt(10000) + 10000;
                val min = random.nextInt(10000) - 10000;

                val rand = Gen.choose(min, max).generate();
                rand should be gte min
                rand should be lt max
            }.config(invocations = 10000, threads = 8)
        }
        "Gen.choose<long, long>" should {
            "only give out numbers in the given range" {
                val random = Random();

                val max = random.nextInt(10000) + 10000;
                val min = random.nextInt(10000) - 10000;

                val rand = Gen.choose(min.toLong(), max.toLong()).generate();
                rand should be gte min.toLong()<commit_msg>added an aditional test for .nextPrintableString, that checks if all the strings are in the printable range<commit_after>package io.kotlintest.properties

import io.kotlintest.matchers.be
import io.kotlintest.matchers.have
import io.kotlintest.specs.WordSpec
import java.util.*

/**
 *  @author <NAME>
 */
class GenTest : WordSpec() {
    init {
        "Gen.string.nextPrintableString" should {
            "give out a argument long string" {
                val random = Random();
                var rand = random.nextInt(10000);
                if (rand <= 0)
                    rand = 0 - rand;
                val string = Gen.string().nextPrintableString(rand);

                string.forEach {
                    it.toInt() should be gte 33
                    it.toInt() should be lt 127
                }
                string.length shouldBe rand
            }.config(invocations = 100, threads = 8)
        }
        "Gen.choose<int, int>" should {
            "only give out numbers in the given range" {
                val random = Random();

                val max = random.nextInt(10000) + 10000;
                val min = random.nextInt(10000) - 10000;

                val rand = Gen.choose(min, max).generate();
                rand should be gte min
                rand should be lt max
            }.config(invocations = 10000, threads = 8)
        }
        "Gen.choose<long, long>" should {
            "only give out numbers in the given range" {
                val random = Random();

                val max = random.nextInt(10000) + 10000;
                val min = random.nextInt(10000) - 10000;

                val rand = Gen.choose(min.toLong(), max.toLong()).generate();
                rand should be gte min.toLong()
{'fraction_non_alphanumeric': 0.10098826436071649, 'fraction_numerical': 0.036751080914144536, 'mean_word_length': 1.595352564102564, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '3429557', 'n_tokens_mistral': 1020, 'n_tokens_neox': 834, 'n_words': 257}