Skip to content

Instantly share code, notes, and snippets.

@bimlas
Last active March 3, 2017 07:09
Show Gist options
  • Select an option

  • Save bimlas/fabc97e6df5ce3026916fccf9f76355f to your computer and use it in GitHub Desktop.

Select an option

Save bimlas/fabc97e6df5ce3026916fccf9f76355f to your computer and use it in GitHub Desktop.

Revisions

  1. bimlas renamed this gist Mar 3, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. bimlas created this gist Mar 3, 2017.
    164 changes: 164 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,164 @@
    1..123
    not ok 1 - DateTime .from_unix_time() makes a DateTime object from unix time
    # Error occurred line:
    # 2: Assert Equals(dt.to_string(), '2012-01-02 03:04:05 +0900')
    # The equivalent values were expected, but it was not the case.
    #
    # expected: '2012-01-02 03:04:05 +0900'
    # got: '10178-02-16 07:04:05 +0900'
    ok 2 - DateTime .from_date() makes a DateTime object from date info
    ok 3 - DateTime .from_format() makes a DateTime object from formatted string
    ok 4 - DateTime .from_format() can treat the some format specifier
    ok 5 - DateTime .from_format() can skip any text by %*
    ok 6 - DateTime .from_format() throws an exception with invalid format
    ok 7 - DateTime .from_julian_day() makes a DateTime object from string
    not ok 8 - DateTime .timezone() makes a TimeZone object
    # Error occurred line:
    # 3: Assert Compare(tz.hours(), '>=', -12)
    # The right expression was expected, but it was not the case.
    #
    # expression: -71582787 >= -12
    ok 9 - DateTime .timezone() makes a TimeZone object from time string
    ok 10 - DateTime .timezone() makes a TimeZone object from hour
    ok 11 - DateTime .timezone() just returns a TimeZone object that was supplied from argument
    ok 12 - DateTime .timezone() throws an exception with invalid argument
    ok 13 - DateTime .delta() makes TimeDelta object from days and seconds
    ok 14 - DateTime .delta() makes TimeDelta object from values and units
    ok 15 - DateTime .delta() throws an exception with invalid unit
    ok 16 - DateTime .delta() throws an exception with invalid arguments
    ok 17 - DateTime .compare() returns -1 when left one is later more than right one
    ok 18 - DateTime .compare() returns 0 when left one and right one is same time
    ok 19 - DateTime .compare() returns 1 when left one is precedes more than right one
    ok 20 - DateTime .month_names() with {longname} is 0 returns the list of name of months
    ok 21 - DateTime .month_names() with {longname} is 1 returns the list of long name of months
    ok 22 - DateTime .weekday_names() with {longname} is 0 returns the list of name of weekdays
    ok 23 - DateTime .weekday_names() with {longname} is 1 returns the list of long name of weekdays
    ok 24 - DateTime .am_pm_names() {lowercase} is 0 returns the list of am/pm names in uppercase
    ok 25 - DateTime .am_pm_names() {lowercase} is 1 returns the list of am/pm names in lowercase
    ok 26 - DateTime .is_leap_year() judges whether a year is a leap year
    ok 27 - DateTime DateTime object .year() returns the year
    ok 28 - DateTime DateTime object .month() returns the month
    ok 29 - DateTime DateTime object .day() returns the day
    ok 30 - DateTime DateTime object .hour() returns the hour
    ok 31 - DateTime DateTime object .minute() returns the minute
    ok 32 - DateTime DateTime object .second() returns the second
    ok 33 - DateTime DateTime object .timezone() without an argument returns the TimeZone object
    ok 34 - DateTime DateTime object .timezone() with an argument sets TimeZone object
    ok 35 - DateTime DateTime object .timezone() with an argument does not change the original DateTime object
    ok 36 - DateTime DateTime object .timezone() with an argument does not change the time
    ok 37 - DateTime DateTime object .day_of_week() returns day of the week
    ok 38 - DateTime DateTime object .day_of_year() returns day of the year
    ok 39 - DateTime DateTime object .days_from_era() returns day of the year
    ok 40 - DateTime DateTime object .julian_day() does not change the result by timezone
    ok 41 - DateTime DateTime object .julian_day() without an argument returns Julian day by integer value
    ok 42 - DateTime DateTime object .julian_day() with an argument 1 returns Julian day by float value
    ok 43 - DateTime DateTime object .seconds_of_day() returns the number of seconds of the day
    ok 44 - DateTime DateTime object .quarter() returns the quarter of the year
    ok 45 - DateTime DateTime object .unix_time() does not change the result by timezone
    not ok 46 - DateTime DateTime object .unix_time() can interconvert with .from_unix_time()
    # Error occurred line:
    # 4: Assert Equals(new_dt.to_string(), dt.to_string())
    # The equivalent values were expected, but it was not the case.
    #
    # expected: '2012-01-02 03:04:05 +0900'
    # got: '10178-02-16 07:04:05 +0900'
    ok 47 - DateTime DateTime object .unix_time() when DateTime is in the range of unix time returns the unix time
    not ok 48 - DateTime DateTime object .unix_time() when DateTime is out of the range of unix time returns -1
    # Error occurred line:
    # 2: Assert Equals(dt.unix_time(), -1)
    # The equivalent values were expected, but it was not the case.
    #
    # expected: -1
    # got: 257697946800
    ok 49 - DateTime DateTime object .is_leap_year() judges whether the year is a leap year
    ok 50 - DateTime DateTime object .is() checks that this and other DateTime are same
    ok 51 - DateTime DateTime object .compare() returns -1 when this one is later more than other one
    ok 52 - DateTime DateTime object .compare() returns 0 when this one and other one is same time
    ok 53 - DateTime DateTime object .compare() returns 1 when this one is precedes more than other one
    ok 54 - DateTime DateTime object .delta() returns TimeDelta object
    ok 55 - DateTime DateTime object .to() with TimeDelta object returns new DateTime object to which time was changed
    ok 56 - DateTime DateTime object .to() with arguments like TimeDelta returns new DateTime object to which time was changed
    ok 57 - DateTime DateTime object .to() with TimeZone object returns new DateTime object to which timezone was changed
    ok 58 - DateTime DateTime object .to() with TimeZone object does not change the time
    ok 59 - DateTime DateTime object .to() with arguments like TimeZone returns new DateTime object to which timezone was changed
    ok 60 - DateTime DateTime object .to() with arguments like TimeZone does not change the time
    ok 61 - DateTime DateTime object .format() symbol "%%" is the '%' character
    ok 62 - DateTime DateTime object .format() symbol "%a" is the abbreviated weekday name
    ok 63 - DateTime DateTime object .format() symbol "%A" is the full weekday name
    ok 64 - DateTime DateTime object .format() symbol "%b" is the abbreviated month name
    ok 65 - DateTime DateTime object .format() symbol "%B" is the full month name
    ok 66 - DateTime DateTime object .format() symbol "%c" is equivalent to "%F %T %z"
    ok 67 - DateTime DateTime object .format() symbol "%C" is the century number (year/100) as a 2-digit integer
    ok 68 - DateTime DateTime object .format() symbol "%d" is the day of the month as a decimal number
    ok 69 - DateTime DateTime object .format() symbol "%D" is equivalent to "%m/%d/%y"
    ok 70 - DateTime DateTime object .format() symbol "%e" is equivalent to "%_m/%_d/%_y"
    ok 71 - DateTime DateTime object .format() symbol "%F" is equivalent to "%Y-%m-%d"
    ok 72 - DateTime DateTime object .format() symbol "%h" is equivalent to "%b"
    ok 73 - DateTime DateTime object .format() symbol "%H" is the hour as a decimal number using a 24-hour clock (range 00 to 23)
    ok 74 - DateTime DateTime object .format() symbol "%I" is the hour as a decimal number using a 12-hour clock (range 01 to 12)
    ok 75 - DateTime DateTime object .format() symbol "%j" is the day of the year as a decimal number (range 001 to 366)
    ok 76 - DateTime DateTime object .format() symbol "%k" is equivalent to "%_H"
    ok 77 - DateTime DateTime object .format() symbol "%l" is equivalent to "%_I"
    ok 78 - DateTime DateTime object .format() symbol "%m" is the month as a decimal number (range 01 to 12)
    ok 79 - DateTime DateTime object .format() symbol "%M" is the minute as a decimal number (range 00 to 59)
    ok 80 - DateTime DateTime object .format() symbol "%n" is a newline character
    ok 81 - DateTime DateTime object .format() symbol "%p" is either "AM" or "PM" according to the given time value
    ok 82 - DateTime DateTime object .format() symbol "%P" is either "am" or "pm" according to the given time value
    ok 83 - DateTime DateTime object .format() symbol "%r" is equivalent to "%I:%M:%S %p"
    ok 84 - DateTime DateTime object .format() symbol "%R" is equivalent to "%H:%M"
    ok 85 - DateTime DateTime object .format() symbol "%s" is the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000
    ok 86 - DateTime DateTime object .format() symbol "%S" is the second as a decimal number (range 00 to 59)
    ok 87 - DateTime DateTime object .format() symbol "%t" is a tab character
    ok 88 - DateTime DateTime object .format() symbol "%u" is the day of the week as a decimal, range 1 to 7, Monday being 1.
    ok 89 - DateTime DateTime object .format() symbol "%T" is equivalent to "%H:%M:%S"
    ok 90 - DateTime DateTime object .format() symbol "%w" is the day of the week as a decimal, range 0 to 6, Sunday being 0
    ok 91 - DateTime DateTime object .format() symbol "%y" is the year as a decimal number without a century (range 00 to 99)
    ok 92 - DateTime DateTime object .format() symbol "%Y" is the year as a decimal number including the century
    ok 93 - DateTime DateTime object .format() symbol "%z" is the +hhmm or -hhmm numeric timezone
    not ok 94 - DateTime DateTime object .strftime() is same as "format('%z')"
    # Error occurred line:
    # 1: Assert Equals(dt.strftime('%z'), dt.format('%z'))
    # The equivalent values were expected, but it was not the case.
    #
    # expected: '+0300'
    # got: '(Invalid)'
    not ok 95 - DateTime DateTime object .strftime() is same as "format('%Y-%m-%d %H:%M:%S')"
    # Error occurred line:
    # 2: Assert Equals(dt.strftime(ft), dt.format(ft))
    # The equivalent values were expected, but it was not the case.
    #
    # expected: '2012-01-02 03:04:05'
    # got: '(Invalid)'
    ok 96 - DateTime DateTime object .to_string() is same as "format('%c')"
    ok 97 - DateTime DateTime object when returns a new Object .day_of_week() does not have a old cached value
    ok 98 - DateTime DateTime object when returns a new Object .day_of_year() does not have a old cached value
    ok 99 - DateTime DateTime object when returns a new Object .days_from_era() does not have a old cached value
    ok 100 - DateTime DateTime object when returns a new Object .unix_time() does not have a old cached value
    ok 101 - DateTime TimeZone object .offset() returns the offset in second
    ok 102 - DateTime TimeZone object .minutes() returns the offset in minute
    ok 103 - DateTime TimeZone object .hours() returns the offset in hour
    ok 104 - DateTime TimeZone object .sign() returns the offset of sign
    ok 105 - DateTime TimeZone object .offset_string() returns the offset by the format used by RFC 2822
    ok 106 - DateTime TimeZone object .w3c() returns the offset by the format used by W3CDTF
    ok 107 - DateTime TimeDelta object .seconds() returns seconds component
    ok 108 - DateTime TimeDelta object .minutes() returns minutes component
    ok 109 - DateTime TimeDelta object .hours() returns hours component
    ok 110 - DateTime TimeDelta object .days() returns days component
    ok 111 - DateTime TimeDelta object .total_seconds() returns the total seconds of the delta
    ok 112 - DateTime TimeDelta object .sign() returns the sign of the delta
    ok 113 - DateTime TimeDelta object .negate() returns new negated TimeDelta object
    ok 114 - DateTime TimeDelta object .duration() returns new TimeDelta object that is absolute value
    ok 115 - DateTime TimeDelta object .is() returns true if two TimeDeltas are same
    ok 116 - DateTime TimeDelta object .is() returns false if two TimeDeltas are not same
    ok 117 - DateTime TimeDelta object .add() returns new TimeDelta object which added this and other
    ok 118 - DateTime TimeDelta object .subtract() returns new TimeDelta object which subtracted this and other
    ok 119 - DateTime TimeDelta object .about() returns a string that about this delta
    ok 120 - DateTime TimeDelta object .to_string() returns a string representation
    ok 121 - DateTime TimeDelta object with strange initialization is normalized correctly (plus)
    ok 122 - DateTime TimeDelta object with strange initialization is normalized correctly (minus)
    ok 123 - DateTime TimeDelta object with strange initialization is normalized correctly (zero)

    # tests 123
    # passes 117
    # fails 6