Skip to content

Conversation

@brofield
Copy link
Owner

This commit significantly expands the test suite with 7 new test files covering:

New Test Coverage:

  • ts-numeric.cpp: Tests for GetLongValue, GetDoubleValue, SetLongValue, SetDoubleValue including hex values, edge cases, and multikey scenarios
  • ts-boolean.cpp: Tests for GetBoolValue and SetBoolValue with all recognized boolean formats (true/t/yes/y/1/on, false/f/no/n/0/off)
  • ts-sections.cpp: Tests for GetSection, GetSectionSize, SectionExists, KeyExists, GetAllSections, GetAllKeys
  • ts-deletion.cpp: Tests for Delete and DeleteValue with various scenarios including multikey deletion and removeEmpty option
  • ts-edgecases.cpp: Tests for special characters, whitespace handling, long values, Unicode, malformed input, and other edge cases
  • ts-multiline.cpp: Tests for multiline values with various end tags, whitespace, Unicode, and edge cases
  • ts-casesensitivity.cpp: Tests for both case-sensitive (CSimpleIniCaseA) and case-insensitive (CSimpleIniA) modes

Test Statistics:

  • Added 123 new tests (from 35 to 158 total tests)
  • All 158 tests passing
  • Test coverage now includes previously untested API methods

Build Improvements:

  • Bumped minimum CMake version to 3.16
  • Added precompiled headers (PCH) support for faster test compilation
  • PCH includes common headers: string, map, list, algorithm, SimpleIni.h

This comprehensive test suite validates library functionality, uncovers edge cases, and provides regression testing for future development.

This commit significantly expands the test suite with 7 new test files covering:

**New Test Coverage:**
- ts-numeric.cpp: Tests for GetLongValue, GetDoubleValue, SetLongValue, SetDoubleValue
  including hex values, edge cases, and multikey scenarios
- ts-boolean.cpp: Tests for GetBoolValue and SetBoolValue with all recognized boolean
  formats (true/t/yes/y/1/on, false/f/no/n/0/off)
- ts-sections.cpp: Tests for GetSection, GetSectionSize, SectionExists, KeyExists,
  GetAllSections, GetAllKeys
- ts-deletion.cpp: Tests for Delete and DeleteValue with various scenarios including
  multikey deletion and removeEmpty option
- ts-edgecases.cpp: Tests for special characters, whitespace handling, long values,
  Unicode, malformed input, and other edge cases
- ts-multiline.cpp: Tests for multiline values with various end tags, whitespace,
  Unicode, and edge cases
- ts-casesensitivity.cpp: Tests for both case-sensitive (CSimpleIniCaseA) and
  case-insensitive (CSimpleIniA) modes

**Test Statistics:**
- Added 123 new tests (from 35 to 158 total tests)
- All 158 tests passing
- Test coverage now includes previously untested API methods

**Build Improvements:**
- Bumped minimum CMake version to 3.16
- Added precompiled headers (PCH) support for faster test compilation
- PCH includes common headers: string, map, list, algorithm, SimpleIni.h

This comprehensive test suite validates library functionality, uncovers edge cases,
and provides regression testing for future development.
The precompiled headers were being applied to both C and C++ compilation,
causing Windows MSVC to fail with 'STL1003: Unexpected compiler, expected
C++ compiler' when trying to compile C++ STL headers with the C compiler.

Fix: Use CMake generator expressions to restrict PCH to C++ language only:
$<$<COMPILE_LANGUAGE:CXX>:...>

This ensures C++ headers are only precompiled for C++ source files, not C files.
Tests still pass with 158/158 on Linux and should now work on Windows.
Generator expressions in target_precompile_headers() are not compatible with
MSVC's PCH implementation, causing malformed include directives in the generated
PCH file (e.g., trying to #include '>').

Solution: Conditionally disable PCH on MSVC while keeping it enabled for GCC/Clang
where it works correctly. This maintains the build speed improvement on Unix-like
systems while ensuring Windows builds succeed.

Tests: 158/158 passing on Linux with PCH, Windows should now build successfully.
Precompiled headers were causing cross-platform compatibility issues with MSVC.
Removing PCH simplifies the build system and ensures compatibility across all
platforms without the added complexity.

Changes:
- Reverted minimum CMake version from 3.16 to 3.14
- Removed all PCH configuration
- Tests: 158/158 passing on Linux, Windows builds should now succeed
The test was using 0xDEADBEEF (3,735,928,559) which exceeds the maximum
value for 32-bit signed long (2,147,483,647). Windows uses 32-bit long
even on 64-bit systems, causing the test to fail.

Changed to 0x12345678 (305,419,896) which fits comfortably in 32-bit
signed long and still tests hex parsing functionality.

Tests: 158/158 passing on Linux, should now pass on Windows.
@brofield brofield merged commit 06b4848 into master Nov 13, 2025
4 checks passed
@brofield brofield deleted the claude/improve-test-coverage-011CV5pJPkMuesbyNYR2zNQq branch November 13, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants