|
22 | 22 | global fac0, fac1, fac2 = DFGFactorSCA()
|
23 | 23 | end
|
24 | 24 |
|
| 25 | + |
| 26 | +@testset "Custom Printing" begin |
| 27 | + |
| 28 | +iobuf = IOBuffer() |
| 29 | +# for now just test the interface and a bit of output |
| 30 | +@test printVariable(var1) == nothing |
| 31 | +@test printFactor(fac1) == nothing |
| 32 | + |
| 33 | +@test printVariable(iobuf, var1, skipfields=[:timestamp, :solver, :ppe]) == nothing |
| 34 | +@test String(take!(iobuf)) == "DFGVariable{TestSofttype1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict(\"small\"=>\"data\")\nbigData:\nDict{Symbol,AbstractBigDataEntry}()\n_dfgNodeParams:\nDFGNodeParams(0)\n" |
| 35 | + |
| 36 | +@test printVariable(iobuf, var1, short=true) == nothing |
| 37 | +@test String(take!(iobuf)) == "DFGVariable{TestSofttype1}\nlabel: a\ntags: Set([:VARIABLE, :POSE])\nsize marginal samples: (1, 1)\nkde bandwidths: [0.0]\nNo PPEs\n" |
| 38 | + |
| 39 | + |
| 40 | +@test printFactor(iobuf, fac1, skipfields=[:timestamp, :solver]) == nothing |
| 41 | +@test occursin(r"DFGFactor.*\nlabel:\n:abf1", String(take!(iobuf))) |
| 42 | + |
| 43 | +String(take!(iobuf)) == "DFGFactor{TestCCW{TestFunctorInferenceType1}}\nlabel:\n:abf1\ntags:\nSet([:tag1, :tag2])\nsolvable:\n0\n_dfgNodeParams:\nDFGNodeParams(1)\n_variableOrderSymbols:\n[:a, :b]\n" |
| 44 | + |
| 45 | +@test printFactor(iobuf, fac1, short=true) == nothing |
| 46 | +@test occursin(r"DFGFactor.*\nlabel.*\ntimestamp.*\ntags.*\nsolvable", String(take!(iobuf))) |
| 47 | + |
| 48 | +# s = String(take!(iobuf)) |
| 49 | + |
| 50 | +@test show(var1) == nothing |
| 51 | +@test show(fac1) == nothing |
| 52 | + |
| 53 | +@test show(iobuf, MIME("text/plain"), var1) == nothing |
| 54 | +isapprox(length(take!(iobuf)), 452, atol=10) |
| 55 | +@test show(iobuf, MIME("text/plain"), fac1) == nothing |
| 56 | +isapprox(length(take!(iobuf)), 301, atol=10) |
| 57 | + |
| 58 | +end |
| 59 | + |
25 | 60 | @testset "Variables and Factors CRUD and SET" begin
|
26 | 61 | VariablesandFactorsCRUD_SET!(fg1, var1, var2, var3, fac0, fac1, fac2)
|
27 | 62 | end
|
|
0 commit comments