Sha256: 10c60362869ddc84debb6cf217dbac379c7ef16c72231608fe29bf849cc98c71

Contents?: true

Size: 1.41 KB

Versions: 71

Compression:

Stored size: 1.41 KB

Contents

import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

import org.scalatest.{Matchers, FunSuite}

/** @version 1.1.0 */
class GigasecondTest extends FunSuite with Matchers {

  private def dateTime(str: String): LocalDateTime =
    LocalDateTime.from(DateTimeFormatter.ISO_DATE_TIME.parse(str))
  private def date(str: String): LocalDate =
    LocalDate.from(DateTimeFormatter.ISO_DATE.parse(str))

  test("date only specification of time") {
    val input = date("2011-04-25")
    val expected = dateTime("2043-01-01T01:46:40")
    Gigasecond.add(input) should be (expected)
  }

  test("second test for date only specification of time") {
    pending
    val input = date("1977-06-13")
    val expected = dateTime("2009-02-19T01:46:40")
    Gigasecond.add(input) should be (expected)
  }

  test("third test for date only specification of time") {
    pending
    val input = date("1959-07-19")
    val expected = dateTime("1991-03-27T01:46:40")
    Gigasecond.add(input) should be (expected)
  }

  test("full time specified") {
    pending
    val input = dateTime("2015-01-24T22:00:00")
    val expected = dateTime("2046-10-02T23:46:40")
    Gigasecond.add(input) should be (expected)
  }

  test("full time with day roll-over") {
    pending
    val input = dateTime("2015-01-24T23:59:59")
    val expected = dateTime("2046-10-03T01:46:39")
    Gigasecond.add(input) should be (expected)
  }
}

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.179 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.178 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.177 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.176 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.175 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.174 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.173 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.172 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.171 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.170 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.169 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.167 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.166 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.165 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.164 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.163 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.162 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.161 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala
trackler-2.2.1.160 tracks/scala/exercises/gigasecond/src/test/scala/GigasecondTest.scala