149
149
@test solverDataDict (v1) == v1. solverDataDict
150
150
@test internalId (v1) == v1. _internalId
151
151
152
+ @test softtype (v1) == :ContinuousScalar # Symbol(typeof(st1))
153
+ @test softtype (v2) == :ContinuousScalar # Symbol(typeof(st2))
154
+ @test typeof (getSofttype (v1)) == typeof (ContinuousScalar ())
155
+
152
156
@test label (f1) == f1. label
153
157
@test tags (f1) == f1. tags
154
158
@test solverData (f1) == f1. data
167
171
168
172
@test ! isInitialized (v2, key= :second )
169
173
174
+ # Session, robot, and user small data tests
175
+ smallUserData = Dict {Symbol, String} (:a => " 42" , :b => " Hello" )
176
+ smallRobotData = Dict {Symbol, String} (:a => " 43" , :b => " Hello" )
177
+ smallSessionData = Dict {Symbol, String} (:a => " 44" , :b => " Hello" )
178
+ setUserData (dfg, deepcopy (smallUserData))
179
+ setRobotData (dfg, deepcopy (smallRobotData))
180
+ setSessionData (dfg, deepcopy (smallSessionData))
181
+ @test getUserData (dfg) == smallUserData
182
+ @test getRobotData (dfg) == smallRobotData
183
+ @test getSessionData (dfg) == smallSessionData
184
+
185
+ end
186
+
187
+ @testset " BigData" begin
188
+ oid = zeros (UInt8,12 ); oid[12 ] = 0x01
189
+ de1 = MongodbBigDataEntry (:key1 , NTuple {12,UInt8} (oid))
190
+
191
+ oid = zeros (UInt8,12 ); oid[12 ] = 0x02
192
+ de2 = MongodbBigDataEntry (:key2 , NTuple {12,UInt8} (oid))
193
+
194
+ oid = zeros (UInt8,12 ); oid[12 ] = 0x03
195
+ de2_update = MongodbBigDataEntry (:key2 , NTuple {12,UInt8} (oid))
196
+
197
+ # add
198
+ v1 = getVariable (dfg, :a )
199
+ @test addBigDataEntry! (v1, de1)
200
+ @test addBigDataEntry! (dfg, :a , de2)
201
+ @test addBigDataEntry! (v1, de1)
202
+
203
+ # get
204
+ @test deepcopy (de1) == getBigDataEntry (v1, :key1 )
205
+ @test deepcopy (de2) == getBigDataEntry (dfg, :a , :key2 )
206
+ @test_throws Any getBigDataEntry (v2, :key1 )
207
+ @test_throws Any getBigDataEntry (dfg, :b , :key1 )
208
+
209
+ # update
210
+ @test updateBigDataEntry! (dfg, :a , de2_update)
211
+ @test deepcopy (de2_update) == getBigDataEntry (dfg, :a , :key2 )
212
+ @test ! updateBigDataEntry! (dfg, :b , de2_update)
213
+
214
+ # list
215
+ entries = getBigDataEntries (dfg, :a )
216
+ @test length (entries) == 2
217
+ @test symdiff (map (e-> e. key, entries), [:key1 , :key2 ]) == Symbol[]
218
+ @test length (getBigDataEntries (dfg, :b )) == 0
219
+
220
+ @test symdiff (getBigDataKeys (dfg, :a ), [:key1 , :key2 ]) == Symbol[]
221
+ @test getBigDataKeys (dfg, :b ) == Symbol[]
222
+
223
+ # delete
224
+ @test deepcopy (de1) == deleteBigDataEntry! (v1, :key1 )
225
+ @test getBigDataKeys (v1) == Symbol[:key2 ]
226
+ # delete from dfg
227
+ @test deepcopy (de2_update) == deleteBigDataEntry! (dfg, :a , :key2 )
228
+ @test getBigDataKeys (v1) == Symbol[]
170
229
end
171
230
172
231
@testset " Updating Nodes" begin
@@ -178,13 +237,13 @@ end
178
237
estimates (newvar)[:default ] = Dict {Symbol, VariableEstimate} (
179
238
:max => VariableEstimate (:default , :max , [100.0 ]),
180
239
:mean => VariableEstimate (:default , :mean , [50.0 ]),
181
- :ppe => VariableEstimate (:default , :ppe , [75.0 ]))
240
+ :modefit => VariableEstimate (:default , :modefit , [75.0 ]))
182
241
# update
183
242
updateVariableSolverData! (dfg, newvar)
184
243
# TODO maybe implement ==; @test newvar==var
185
244
Base.:(== )(varest1:: VariableEstimate , varest2:: VariableEstimate ) = begin
186
245
varest1. lastUpdatedTimestamp == varest2. lastUpdatedTimestamp || return false
187
- varest1. type == varest2. type || return false
246
+ varest1. ppeType == varest2. ppeType || return false
188
247
varest1. solverKey == varest2. solverKey || return false
189
248
varest1. estimate == varest2. estimate || return false
190
249
return true
198
257
estimates (newvar)[:second ] = Dict {Symbol, VariableEstimate} (
199
258
:max => VariableEstimate (:default , :max , [10.0 ]),
200
259
:mean => VariableEstimate (:default , :mean , [5.0 ]),
201
- :ppe => VariableEstimate (:default , :ppe , [7.0 ]))
260
+ :modefit => VariableEstimate (:default , :modefit , [7.0 ]))
202
261
203
262
# Persist to the original variable.
204
263
updateVariableSolverData! (dfg, newvar)
348
407
# Check all fields are equal for all variables
349
408
for v in ls (summaryGraph)
350
409
for field in variableFields
410
+ if field != :softtypename
351
411
@test getfield (getVariable (dfg, v), field) == getfield (getVariable (summaryGraph, v), field)
412
+ else
413
+ @test softtype (getVariable (dfg, v)) == softtype (getVariable (summaryGraph, v))
352
414
end
353
415
end
416
+ end
354
417
for f in lsf (summaryGraph)
355
418
for field in factorFields
356
419
@test getfield (getFactor (dfg, f), field) == getfield (getFactor (summaryGraph, f), field)
0 commit comments