CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
date4.test45 linesDownload Raw Back to test
1# 2023-08-292#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11#12# Test cases for the strftime() SQL function.  Comparisons against the13# C-library strftime() function.14 15set testdir [file dirname $argv0]16source $testdir/tester.tcl17 18# Skip this whole file if date and time functions are omitted19# at compile-time20#21ifcapable {!datetime} {22  finish_test23  return24}25 26if {$tcl_platform(os)=="Linux"} {27  if {"" eq [strftime {%P} 1]} {28    # This is probably musl libc, which does not support29    # %k, %l, %P30    set FMT {%d,%e,%F,%H,%I,%j,%m,%M,%u,%w,%W,%Y,%%,%p,%U,%V,%G,%g}31  } else {32    set FMT {%d,%e,%F,%H,%k,%I,%l,%j,%m,%M,%u,%w,%W,%Y,%%,%P,%p,%U,%V,%G,%g}33  }34} else {35  set FMT {%d,%e,%F,%H,%I,%j,%p,%R,%u,%w,%W,%%}36}37for {set i 0} {$i<=24858} {incr i} {38  set TS [expr {$i*86390}]39  do_execsql_test date4-$i {40    SELECT strftime($::FMT,$::TS,'unixepoch');41  } [list [strftime $FMT $TS]]42}43 44finish_test45