MCPcopy
hub / github.com/perkeep/perkeep / TestQueryPermanodeAttrNumValue

Function TestQueryPermanodeAttrNumValue

pkg/search/query_test.go:438–465  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

436}
437
438func TestQueryPermanodeAttrNumValue(t *testing.T) {
439 testQuery(t, func(qt *queryTest) {
440 id := qt.id
441
442 // TODO(bradfitz): if we set an empty attribute value here and try to search
443 // by NumValue IntConstraint Min = 1, it fails only in classic (no corpus) mode.
444 // Something there must be skipping empty values.
445 p1 := id.NewPlannedPermanode("1")
446 id.AddAttribute(p1, "x", "1")
447 id.AddAttribute(p1, "x", "2")
448 p2 := id.NewPlannedPermanode("2")
449 id.AddAttribute(p2, "x", "1")
450 id.AddAttribute(p2, "x", "2")
451 id.AddAttribute(p2, "x", "3")
452
453 sq := &SearchQuery{
454 Constraint: &Constraint{
455 Permanode: &PermanodeConstraint{
456 Attr: "x",
457 NumValue: &IntConstraint{
458 Min: 3,
459 },
460 },
461 },
462 }
463 qt.wantRes(sq, p2)
464 })
465}
466
467// Tests that NumValue queries with ZeroMax return permanodes without any values.
468func TestQueryPermanodeAttrNumValueZeroMax(t *testing.T) {

Callers

nothing calls this directly

Calls 4

testQueryFunction · 0.85
NewPlannedPermanodeMethod · 0.80
AddAttributeMethod · 0.80
wantResMethod · 0.80

Tested by

no test coverage detected