Skip to content

Commit 6f65704

Browse files
committed
added tests
1 parent bf7d0f6 commit 6f65704

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/DataBlobs/services/BlobEntry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ If the blob label `datalabel_1` already exists, then this function will return t
399399
"""
400400
function incrDataLabelSuffix(
401401
dfg::AbstractDFG,
402-
vla,
402+
vla::Union{Symbol, <:AbstractString},
403403
bllb::S;
404404
datalabel = Ref(""),
405405
) where {S <: Union{Symbol, <:AbstractString}}

test/testBlocks.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,11 +1152,29 @@ function blobsStoresTestBlock!(fg)
11521152
# Getting
11531153
data = getData(fg, fs, :a, :testing) # convenience wrapper over getBlob
11541154
@test data[1].hash == newData.hash #[1]
1155+
# more dispatches
1156+
data = getData(fg, :a, :testing) # convenience wrapper over getBlob
1157+
@test data[1].hash == newData.hash #[1]
1158+
data = getData(fg, :a, "testing") # convenience wrapper over getBlob
1159+
@test data[1].hash == newData.hash #[1]
1160+
data = getData(fg, :a, r"testing") # convenience wrapper over getBlob
1161+
@test data[1].hash == newData.hash #[1]
1162+
be = getBlobEntry(fg, :a, r"testing")
1163+
data = getData(fg, :a, be.originId) # convenience wrapper over getBlob
1164+
@test data[1].hash == newData.hash #[1]
11551165
# @test data[2] == newData[2]
11561166
# Updating
11571167
updateData = updateData!(fg, fs, :a, newData, rand(UInt8, 50)) # convenience wrapper around updateBlob!
11581168
@test updateData[1].hash != data[1].hash
11591169
@test updateData[2] != data[2]
1170+
@show bllb = DistributedFactorGraphs.incrDataLabelSuffix(fg, :a, :testing)
1171+
newData2 = addData!(fg, fs.key, :a, bllb, testData) # convenience wrapper over addBlob!
1172+
nbe = listBlobEntries(fg, :a)
1173+
filter!(s->occursin(r"testing",string(s)), nbe)
1174+
@test 2 == length(nbe)
1175+
# TODO: incrSuffix when adding repeat labels, e.g. :testing_1, :testing_2
1176+
data2 = getData(fg, :a, :testing)
1177+
data3 = getData(fg, :a, bllb)
11601178
# Deleting
11611179
return retData = deleteData!(fg, :a, :testing) # convenience wrapper around deleteBlob!
11621180
end

0 commit comments

Comments
 (0)