<commit_before>package com.widen.tabitha

import spock.lang.*

class ValueTest extends Specification {
    def "values unbox to correct primitives"() {
        expect:
        value.stringValue().orElse(null) == stringValue.orElse(null)
        value.booleanValue().orElse(null) == booleanValue.orElse(null)
        value.integerValue().orElse(null) == integerValue.orElse(null)
        value.floatValue().orElse(null) == floatValue.orElse(null)

        where:
        value                   | stringValue        | booleanValue      | integerValue     | floatValue
        new Value.String("foo") | Optional.of("foo") | Optional.empty()  | Optional.empty() | Optional.empty()
        Value.Bool.True         | Optional.empty()   | Optional.of(true) | Optional.empty() | Optional.empty()
        new Value.Int(42)       | Optional.empty()   | Optional.empty()  | Optional.of(42)  | Optional.empty()
        new Value.Float(3.141)  | Optional.empty()   | Optional.empty()  | Optional.empty() | Optional.of(3.141)
    }

    def "value equality is reflexive and works unboxed"() {
        expect:
        boxed == boxed
        boxed == unboxed

        where:
        boxed                   | unboxed
        new Value.String("foo") | "foo"
        Value.Bool.True         | true
        new Value.Int(42)       | 42
        new Value.Float(3.141)  | 3.141
    }

    def "asString correct depending on value type"() {
        expect:
        value.asString() == string

        where:
        value                   | string
        new Value.String("foo") | "foo"
        Value.Bool.True         | "true"<commit_msg>Fix value tests<commit_after>package com.widen.tabitha

import spock.lang.*

class ValueTest extends Specification {
    def "values unbox to correct primitives"() {
        expect:
        value.stringValue().orElse(null) == stringValue.orElse(null)
        value.booleanValue().orElse(null) == booleanValue.orElse(null)
        value.integerValue().orElse(null) == integerValue.orElse(null)
        value.floatValue().orElse(null) == floatValue.orElse(null)

        where:
        value                   | stringValue        | booleanValue      | integerValue     | floatValue
        new Value.String("foo") | Optional.of("foo") | Optional.empty()  | Optional.empty() | Optional.empty()
        Value.Bool.TRUE         | Optional.empty()   | Optional.of(true) | Optional.empty() | Optional.empty()
        new Value.Int(42)       | Optional.empty()   | Optional.empty()  | Optional.of(42)  | Optional.empty()
        new Value.Float(3.141)  | Optional.empty()   | Optional.empty()  | Optional.empty() | Optional.of(3.141)
    }

    def "value equality is reflexive and works unboxed"() {
        expect:
        boxed == boxed
        boxed == unboxed

        where:
        boxed                   | unboxed
        new Value.String("foo") | "foo"
        Value.Bool.TRUE         | true
        new Value.Int(42)       | 42
        new Value.Float(3.141)  | 3.141
    }

    def "asString correct depending on value type"() {
        expect:
        value.asString() == string

        where:
        value                   | string
        new Value.String("foo") | "foo"
        Value.Bool.TRUE         | "true"
{'fraction_non_alphanumeric': 0.1270820481184454, 'fraction_numerical': 0.014805675508945095, 'mean_word_length': 1.994459833795014, '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': '6196496', 'n_tokens_mistral': 993, 'n_tokens_neox': 928, 'n_words': 195}