Skip to content

CFBag: add a test suite for creation, lookup and mutation#70

Open
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:test/cfbag-coverage
Open

CFBag: add a test suite for creation, lookup and mutation#70
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:test/cfbag-coverage

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

CFBag.c had little direct test coverage. This adds a self-contained CFBag test suite (Tests/CFBag) built on the existing CFTesting.h framework.

Immutable (create.m):

  • CFBagCreate and multiset counting — CFBagGetCount, CFBagGetCountOfValue (including a repeated value and an absent value).
  • Lookup — CFBagContainsValue, CFBagGetValue, CFBagGetValueIfPresent, CFBagGetValues.
  • CFBagCreateCopy, CFBagGetTypeID / CFGetTypeID, and CFEqual / CFHash.

Mutable (mutable.m):

  • CFBagCreateMutable, CFBagAddValue, CFBagSetValue, CFBagReplaceValue (present and absent), CFBagRemoveValue, CFBagRemoveAllValues, CFBagCreateMutableCopy.

This raises CFBag.c line coverage from 22.6% to 93.5% (measured with llvm-cov). All new tests pass and no existing tests are affected. The two remaining uncovered functions are the empty CFBagApplyFunction stub and the internal formatting-description helper.

CFBag.c had little direct coverage.  Add tests exercising the public
API: CFBagCreate and its multiset counting (CFBagGetCount,
CFBagGetCountOfValue), lookup (CFBagContainsValue, CFBagGetValue,
CFBagGetValueIfPresent, CFBagGetValues), CFBagCreateCopy, the type ID,
and CFEqual / CFHash.  The mutable path covers CFBagCreateMutable,
CFBagAddValue, CFBagSetValue, CFBagReplaceValue, CFBagRemoveValue,
CFBagRemoveAllValues and CFBagCreateMutableCopy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant