validate checks cardinality and sort order of the array container
()
| 1340 | |
| 1341 | // validate checks cardinality and sort order of the array container |
| 1342 | func (ac *arrayContainer) validate() error { |
| 1343 | cardinality := ac.getCardinality() |
| 1344 | |
| 1345 | if cardinality <= 0 { |
| 1346 | return ErrEmptyArray |
| 1347 | } |
| 1348 | |
| 1349 | if cardinality > arrayDefaultMaxSize { |
| 1350 | return ErrArrayInvalidSize |
| 1351 | } |
| 1352 | |
| 1353 | previous := ac.content[0] |
| 1354 | for i := 1; i < len(ac.content); i++ { |
| 1355 | next := ac.content[i] |
| 1356 | if previous > next { |
| 1357 | return ErrArrayIncorrectSort |
| 1358 | } |
| 1359 | previous = next |
| 1360 | |
| 1361 | } |
| 1362 | |
| 1363 | return nil |
| 1364 | } |
nothing calls this directly
no test coverage detected