Skip to content

Commit 6e51a98

Browse files
committed
Add another option for running tests
Add an otpiton that runs a single test from a string, this will be useful for copying and pasting while doing many examples
1 parent a49ddac commit 6e51a98

File tree

3 files changed

+37
-21
lines changed

3 files changed

+37
-21
lines changed

test/ManageCSVTests.jl

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,40 @@ function runcsvtest(filename; zeta_function=nothing)
6363
end
6464

6565
for test in eachrow(tests)
66-
n = test.n
67-
varstring = prod(["x$i," for i in 1:n])[1:end-1]
68-
69-
# this isn't secure!
70-
codestring = """begin
71-
using Oscar
72-
R, ($varstring) = polynomial_ring(GF($(test.p)),$n);
73-
$(test.f)
74-
end
75-
"""
66+
testzetafunction(test.n,test.p,test.f,test.zeta_function,zeta_function)
67+
end
7668

77-
f = eval(Meta.parse(codestring))
78-
zeta_result = eval(Meta.parse("begin using Oscar; $(test.zeta_function) end"))
69+
end
7970

80-
zeta_evaluated = zeta_function(f)
81-
println()
82-
println("Testing: p=$(test.p), $n variables, f = $f")
83-
println()
84-
@test zeta_result == zeta_evaluated
71+
function teststring(ts, zeta_function=nothing)
72+
if zeta_function == nothing
73+
zeta_function = DeRham.zeta_function
8574
end
8675

76+
testparts = split(ts,(";"))
77+
78+
n = Meta.parse(testparts[1])
79+
p = Meta.parse(testparts[2])
80+
testzetafunction(n,p,testparts[3],testparts[4],zeta_function)
8781
end
8882

83+
function testzetafunction(n,p,fstring,correctzeta,zeta_function)
84+
varstring = prod(["x$i," for i in 1:n])[1:end-1]
85+
86+
# this isn't secure!
87+
codestring = """begin
88+
using Oscar
89+
R, ($varstring) = polynomial_ring(GF($(p)),$n);
90+
$(fstring)
91+
end
92+
"""
93+
94+
f = eval(Meta.parse(codestring))
95+
zeta_result = eval(Meta.parse("begin using Oscar; $(correctzeta) end"))
96+
97+
println("Testing: p=$(p), $n variables, f = $f")
98+
println()
99+
zeta_evaluated = zeta_function(f)
100+
println()
101+
@test zeta_result == zeta_evaluated
102+
end

test/varieties/failing.csv

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ n;p;f;zeta_function
99
3;19;x1^4*x2 + x1*x3^4 + x2^4*x3;ZZRingElem[]
1010
3;19;x1^6 + x2^6 + x3^6;ZZRingElem[6131066257801, 16779760284508, 22486237466284, 19779593840592, 12922844868366, 6717884388108, 2898157893810, 1065035477580, 338800689465, 94218859460, 23033123780, 4958887340, 938506065, 155275620, 22238610, 2713092, 274686, 22128, 1324, 52, 1]
1111
3;11;5*x1^6*x2 + 3*x1^6*x3 + 7*x1^5*x2^2 + 9*x1^5*x2*x3 + x1^5*x3^2 + 8*x1^4*x2^3 + x1^4*x2^2*x3 + 5*x1^4*x2*x3^2 + 6*x1^3*x2^4 + 6*x1^3*x2^3*x3 + 9*x1^3*x2^2*x3^2 + 8*x1^3*x2*x3^3 + 5*x1^3*x3^4 + 5*x1^2*x2^5 + 2*x1^2*x2^4*x3 + 7*x1^2*x2^3*x3^2 + 4*x1^2*x2*x3^4 + 10*x1^2*x3^5 + 7*x1*x2^6 + 3*x1*x2^5*x3 + 5*x1*x2^4*x3^2 + 8*x1*x2^3*x3^3 + 2*x1*x2^2*x3^4 + 3*x1*x2*x3^5 + 5*x1*x3^6 + 2*x2^7 + 4*x2^6*x3 + 2*x2^5*x3^2 + 2*x2^4*x3^3 + 9*x2^3*x3^4 + 7*x2^2*x3^5 + 4*x2*x3^6 + 2*x3^7;ZZRingElem[]
12-
4;13;x1^4 + x2^4 + x3^4 + x4^4 + x1*x2*x3*x4;ZZRingElem[-247064529073450392704413, 247064529073450392704413, -108182101487783012190098, 26314565226758029992186, -3538020111026967214597, 147057070629482744861, 34806407249581714760, -6961281449916342952, 483994420334420294, 10297753624136602, -4752809364986124, 365600720383548, -4687188722866, -1303537692158, 110939378056, -3282230120, -82055753, 11681449, -514098, 12506, -169, 1]
13-
4;7;x1^4 + x2^4 + x3^4 + x4^4 + x1*x2*x3*x4;ZZRingElem[-558545864083284007, -11398895185373143, 100961643070447838, 465261027974414, -8075602128413043, 128184160768461, 374379136212648, -16277353748376, -11045347186398, 913524955266, 213551288244, -30507326892, -2663338062, 657187314, 19765032, -9277464, -64827, 83349, -98, -434, 1, 1]
14-
4;11;x1^4 + x2^4 + x3^4 + x4^4 + x1*x2*x3*x4;ZZRingElem[-7400249944258160101211, -1284340899416705472111, 433673550452394055518, 89969571072874291238, -9511594081759437327, -2744452047306082707, 63797972041984488, 47227070212897608, 1186325926400538, -491306696792142, -32681154997260, 2971014090660, 369125993082, -7366150638, -2423495448, -27056568, 9619137, 275517, -21538, -858, 21, 1]
12+

test/varieties/k3surfaces.csv

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
n;p;f;zeta_function
2-
4;11;x1^4 + x2^4 + x3^4 + x4^4;ZZRingElem[-7400249944258160101211, 672749994932560009201, 611590904484145462910, -55599173134922314810, -22745116282468219695, 2067737843860747245, 501269780329878120, -45569980029988920, -7249769550225510, 659069959111410, 71898540993972, -6536230999452, -495169015110, 45015365010, 2338460520, -212587320, -7247295, 658845, 13310, -1210, -11, 1]
32
4;7;x1^4 + x2^4 + x3^4 + x4^4;ZZRingElem[-558545864083284007, 79792266297612001, 113988951853731430, -16284135979104490, -10468373129424315, 1495481875632045, 569707381193160, -81386768741880, -20346692185470, 2906670312210, 498286339236, -71183762748, -8474257470, 1210608210, 98825160, -14117880, -756315, 108045, 3430, -490, -7, 1]
3+
4;11;x1^4 + x2^4 + x3^4 + x4^4;ZZRingElem[-7400249944258160101211, 672749994932560009201, 611590904484145462910, -55599173134922314810, -22745116282468219695, 2067737843860747245, 501269780329878120, -45569980029988920, -7249769550225510, 659069959111410, 71898540993972, -6536230999452, -495169015110, 45015365010, 2338460520, -212587320, -7247295, 658845, 13310, -1210, -11, 1]
44
4;13;x1^4 + x2^4 + x3^4 + x4^4;ZZRingElem[-247064529073450392704413, -80405615970649536087235, -224910813903914786258, 2508620616620588000570, 188312900398839895003, -29841375627214911331, -3496390230500968632, 172033060544399704, 27724721295752390, -827978102045094, -111941095381388, 8610853490876, 376867593102, -74670735230, -2741627512, 329708184, 16651063, -621751, -49010, 26, 55, 1]
55
4;3;x1^4 + x2^4 + x3^4 + x4^4;ZZRingElem[-10460353203,3486784401,11622614670,-3874204890,-5811307335,1937102445,1721868840,-573956280,-334807830,111602610,44641044,-14880348,-4133430,1377810,262440,-87480,-10935,3645,270,-90,-3,1]
6+
4;7;x1^4 + x2^4 + x3^4 + x4^4 + x1*x2*x3*x4;ZZRingElem[-558545864083284007,444556912229552577,-68393371112238858,-34894577098081050,11864156213347557,583950065722989,-645668365352248,30229371246984,19516214953410,-1902188326766,-396595249596,56656464228,5545738562,-1161195630,-36706488,16000264,-295323,-122451,7350,294,-39,1]
7+
4;11;x1^4 + x2^4 + x3^4 + x4^4 + x1*x2*x3*x4;ZZRingElem[-7400249944258160101211,3608386336456458231169,-277995865674611574050,-136470697694809318170,25042602775646827745,1533050078175543917,-641017719088510808,9666359400300680,8818983738586010,-482176723332590,-74181034358860,6743730396260,362266508890,-54758950510,-496037080,271854088,-5373247,-725395,32670,550,-59,1]
8+
4;13;x1^4 + x2^4 + x3^4 + x4^4 + x1*x2*x3*x4;ZZRingElem[-247064529073450392704413,200283079781436117162749,-68597798240694009808690,12197086446327686485530,-961527000269694870245,-42944964238822145123,18174929396387918024,-1805135635289827880,57546270252528070,5824521280620250,-967766612779980,74443585598460,-2651124843250,-154988836990,28767781640,-1713888488,23962679,3174665,-238290,7930,-137,1]
9+
4;11;x1^4 + x2^4 + x3^4 + x4^4 + 2*x1*x2*x3*x4;ZZRingElem[-7400249944258160101211,-1284340899416705472111,433673550452394055518,89969571072874291238,-9511594081759437327,-2744452047306082707,63797972041984488,47227070212897608,1186325926400538,-491306696792142,-32681154997260,2971014090660,369125993082,-7366150638,-2423495448,-27056568,9619137,275517,-21538,-858,21,1]

0 commit comments

Comments
 (0)