<commit_before>/*
 * Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package debop4k.examples.kotlintypes

import io.kotlintest.specs.FunSpec

class KotlinTypeExample : FunSpec() {
  init {

    test("nullability 처리 방식") {

    }
  }
}<commit_msg>-. nullability 관련 예제 추가.<commit_after>/*
 * Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package debop4k.examples.kotlintypes

import io.kotlintest.specs.FunSpec

class KotlinTypeExample : FunSpec() {

  data class Person(val name: String, val manager: Person?)

  data class Address(val street: String, val zipCode: Int, val city: String, val country: String)
  data class Company(val name: String, val address: Address?)
  data class Employee(val name: String, val company: Company?)


  fun Person.managerName(): String? = this.manager?.name

  fun Employee.countryName(): String = company?.address?.country ?: "Unknown"

  init {

    test("nullability 처리 방식") {
      val ceo = Person("<NAME>", null)
      val employee = Person("<NAME>", ceo)

      ceo.managerName() shouldBe null
      employee.managerName() shouldBe "Da Boss"
    }

    test("safe acceess operators can go in a chain") {
      val emp = Employee("Dmitry", null)
      emp.countryName() shouldBe "Unknown"
    }
  }
}
{'fraction_non_alphanumeric': 0.09383100051840332, 'fraction_numerical': 0.005184033177812338, 'mean_word_length': 3.8129675810473818, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3319077', 'n_tokens_mistral': 678, 'n_tokens_neox': 652, 'n_words': 211}