Skip to content

Commit

Permalink
Unit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownJoe796 committed Nov 20, 2024
1 parent 7873efd commit 7e49cde
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ value class Temperature(val celsius: Double) {
val Long.kelvin: Temperature get() = Temperature(celsius = this - 273.15)
val Double.kelvin: Temperature get() = Temperature(celsius = this - 273.15)
}
override fun toString(): String = "$celsius °C"
override fun toString(): String = "$celsius°C"
}

operator fun Acceleration.times(other: Duration): Speed = Speed(metersPerSecond = this.metersPerSecondPerSecond * other.toDouble(DurationUnit.SECONDS))
Expand Down
4 changes: 4 additions & 0 deletions shared/src/commonTest/kotlin/com/lightningkite/UnitsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ class UnitsTest {
val speed = 32.miles / 5.minutes
speed.metersPerSecond
}

@Test fun serIntrospect() {
println(Temperature.serializer().descriptor.isInline)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ class SerializationTest {
(path<LargeTestModel>().map.containsKey("asdf")).cycle()
}

@Test fun samples() {
condition<LargeTestModel> { it.list.any { it.gt(8) or it.lt(2) } }.let {
println(it)
println(myJson.encodeToString(it))
}

}

@Test fun modifications() {
// ((path<LargeTestModel>().int assign 2) then (path<LargeTestModel>().boolean assign true)).cycle()
modification<LargeTestModel> {
Expand Down

0 comments on commit 7e49cde

Please sign in to comment.