MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / validate

Method validate

roaringarray.go:806–827  ·  view source on GitHub ↗

validate checks the referential integrity ensures len(keys) == len(containers), recurses and checks each container type

()

Source from the content-addressed store, hash-verified

804// validate checks the referential integrity
805// ensures len(keys) == len(containers), recurses and checks each container type
806func (ra *roaringArray) validate() error {
807 if !ra.checkKeysSorted() {
808 return ErrKeySortOrder
809 }
810
811 if len(ra.keys) != len(ra.containers) {
812 return ErrCardinalityConstraint
813 }
814
815 if len(ra.keys) != len(ra.needCopyOnWrite) {
816 return ErrCardinalityConstraint
817 }
818
819 for _, container := range ra.containers {
820 err := container.validate()
821 if err != nil {
822 return err
823 }
824 }
825
826 return nil
827}

Callers

nothing calls this directly

Calls 2

checkKeysSortedMethod · 0.95
validateMethod · 0.65

Tested by

no test coverage detected