<commit_before>package com.petertackage.kotlinoptions

import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.never
import com.nhaarman.mockito_kotlin.verify
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test

class OptionTest {

    @Test
    fun `isSome returns true when no-nnull value`() {
        assertThat(Option.optionOf("value").isSome()).isTrue()
    }

    @Test
    fun `isSome returns false when null value`() {
        assertThat(Option.optionOf(null).isSome()).isFalse()
    }

    @Test
    fun `isNone returns true when null value`() {
        assertThat(Option.optionOf(null).isNone()).isTrue()
    }

    @Test
    fun `isNone returns false when non-null value`() {
        assertThat(Option.optionOf("value").isNone()).isFalse()
    }

    @Test
    fun `ifSome performs action with value when Some`() {
        val value = "value"
        val mockAction: (String) -> Unit = mock()

        Option.optionOf(value).ifSome(mockAction)

        verify(mockAction).invoke(value)
    }

    @Test
    fun `ifSome does not perform action with value when None`() {
        val mockAction: (String) -> Unit = mock()

        Option.optionOf(null).ifSome(mockAction)

        verify(mockAction, never()).invoke(any())
    }

    @Test
    fun `ifNone performs action when None`() {
        val mockAction: () -> Unit = mock()

        Option.optionOf(null).ifNone(mockAction)

        verify(mockAction).invoke()
    }

    @Test
    fun `ifNone does not perform action when Some`() {
        val mockAction: () -> Unit = mock()

        Option.optionOf("value").ifNone(mockAction)

        verify(mockAction, never()).invoke()
    }
}<commit_msg>Add tests for map<commit_after>package com.petertackage.kotlinoptions

import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.never
import com.nhaarman.mockito_kotlin.verify
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test

class OptionTest {

    @Test
    fun `isSome returns true when no-nnull value`() {
        assertThat(Option.optionOf("value").isSome()).isTrue()
    }

    @Test
    fun `isSome returns false when null value`() {
        assertThat(Option.optionOf(null).isSome()).isFalse()
    }

    @Test
    fun `isNone returns true when null value`() {
        assertThat(Option.optionOf(null).isNone()).isTrue()
    }

    @Test
    fun `isNone returns false when non-null value`() {
        assertThat(Option.optionOf("value").isNone()).isFalse()
    }

    @Test
    fun `ifSome performs action with value when Some`() {
        val value = "value"
        val mockAction: (String) -> Unit = mock()

        Option.optionOf(value).ifSome(mockAction)

        verify(mockAction).invoke(value)
    }

    @Test
    fun `ifSome does not perform action with value when None`() {
        val mockAction: (String) -> Unit = mock()

        Option.optionOf(null).ifSome(mockAction)

        verify(mockAction, never()).invoke(any())
    }

    @Test
    fun `ifNone performs action when None`() {
        val mockAction: () -> Unit = mock()

        Option.optionOf(null).ifNone(mockAction)

        verify(mockAction).invoke()
    }

    @Test
    fun `ifNone does not perform action when Some`() {
        val mockAction: () -> Unit = mock()

        Option.optionOf("value").ifNone(mockAction)

        verify(mockAction, never()).invoke()
    }

    @Test
    fun `map invokes function with value when Some`() {
        val value = "value"
        val mockFunc: (String) -> Int = mock()

        Option.optionOf(value).map(mockFunc)

        verify(mockFunc).invoke(value)
    }

    @Test
    fun `map return function value when Some`() {
        val value = "value"
        val mockFunc: (String) -> Int = { it.length }

        val result: Option<Int> = Option.optionOf(value).map(mockFunc)

        assertThat(result).isEqualTo(Option.optionOf(value.length))
    }

    @Test
    fun `map does not perform action when None`() {
        val mockFunc: (String) -> Int = mock()

        Option.optionOf(null).map(mockFunc)

        verify(mockFunc, never()).invoke(any())
    }
}
{'fraction_non_alphanumeric': 0.12814428096820124, 'fraction_numerical': 0.0, 'mean_word_length': 2.7566844919786098, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 15, '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': '2367943', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1266, 'n_words': 298}