mirror of
https://github.com/bol-van/zapret2.git
synced 2026-06-17 12:50:04 +04:00
zapret-tests: 64-bit time support checks
This commit is contained in:
+12
-3
@@ -420,26 +420,35 @@ function test_time(...)
|
|||||||
|
|
||||||
local unixtime=os.time()
|
local unixtime=os.time()
|
||||||
local tm = localtime(unixtime);
|
local tm = localtime(unixtime);
|
||||||
|
local t
|
||||||
print()
|
print()
|
||||||
print("now: "..tm.str.." "..tm.zone.." = "..unixtime)
|
print("now: "..tm.str.." "..tm.zone.." = "..unixtime)
|
||||||
local tm = gmtime(unixtime);
|
local tm = gmtime(unixtime);
|
||||||
print("gmt: "..tm.str.." "..tm.zone.." = "..unixtime)
|
print("gmt: "..tm.str.." "..tm.zone.." = "..unixtime)
|
||||||
print()
|
print()
|
||||||
for i=1,20 do
|
for i=1,20 do
|
||||||
unixtime = math.random(0,10000000000);
|
unixtime = math.random(0,0x7FFFFFFF);
|
||||||
tm = localtime(unixtime);
|
tm = localtime(unixtime);
|
||||||
local t = timelocal(tm)
|
t = timelocal(tm)
|
||||||
print("timelocal: "..tm.str.." "..tm.zone.." = "..t)
|
print("timelocal: "..tm.str.." "..tm.zone.." = "..t)
|
||||||
print( t==unixtime and "LOCALTIME OK" or "LOCALTIME FAILED" )
|
print( t==unixtime and "LOCALTIME OK" or "LOCALTIME FAILED" )
|
||||||
test_assert(t==unixtime)
|
test_assert(t==unixtime)
|
||||||
|
|
||||||
unixtime = math.random(0,10000000000);
|
unixtime = math.random(0,0x7FFFFFFF);
|
||||||
tm = gmtime(unixtime);
|
tm = gmtime(unixtime);
|
||||||
t = timegm(tm)
|
t = timegm(tm)
|
||||||
print("timegm: "..tm.str.." "..tm.zone.." = "..t)
|
print("timegm: "..tm.str.." "..tm.zone.." = "..t)
|
||||||
print( t==unixtime and "GMTIME OK" or "GMTIME FAILED" )
|
print( t==unixtime and "GMTIME OK" or "GMTIME FAILED" )
|
||||||
test_assert(t==unixtime)
|
test_assert(t==unixtime)
|
||||||
end
|
end
|
||||||
|
unixtime = math.random(0x80000000,0xFFFFFFFF);
|
||||||
|
tm = gmtime(unixtime)
|
||||||
|
t = timegm(tm)
|
||||||
|
print( t==unixtime and "TIME 0x80000000..0xFFFFFFFF OK" or "TIME 0x80000000..0xFFFFFFFF FAILED : "..unixtime.." != "..t.." ("..tm.str..")" )
|
||||||
|
unixtime = math.random(0x100000000,0x200000000);
|
||||||
|
tm = gmtime(unixtime)
|
||||||
|
t = timegm(tm)
|
||||||
|
print( t==unixtime and "TIME 64 OK" or "TIME 64 FAILED : "..unixtime.." != "..t.." ("..tm.str..")" )
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_gzip()
|
function test_gzip()
|
||||||
|
|||||||
Reference in New Issue
Block a user