Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Thanks for opening a PR in MIES ✨!

  • Code can only be merged if the continous integration tests pass
  • Please ensure that the branch is named correctly. See
    here for the detailed explanation.

Changes

Implemented unit tests for 22 utility functions previously listed as missing test coverage in UTF_Utils_Checks.ipf:

  • Numeric validation: IsFinite, IsNaN, IsInf, IsInteger
  • String operations: IsNull, IsEmpty, StringEndsWith (case-insensitive), ListHasOnlyOneUniqueEntry (case-insensitive)
  • Wave type checks: IsTextWave, IsNumericWave, IsWaveRefWave, IsFloatingPointWave, IsDoubleFloatingPointWave, IsSingleFloatingPointWave, IsComplexWave
  • Wave properties: IsGlobalWave, IsFreeWave
  • Utilities: WindowExists, ValueCanBeWritten, CheckIfClose, CheckIfSmall, FuncRefIsAssigned

Wave Type Testing Implementation

Created a new data generator GetEmptyWavesOfAllTypes() in UTF_DataGenerators.ipf that returns a wave reference wave holding truly empty waves (N=0) of all 15 supported Igor Pro wave types:

  • 10 numeric types: NT_FP64, NT_FP32, NT_I64, NT_I32, NT_I16, NT_I8, and unsigned variants (NT_I64|NT_UNSIGNED, NT_I32|NT_UNSIGNED, NT_I16|NT_UNSIGNED, NT_I8|NT_UNSIGNED)
  • TEXT_WAVE (text waves)
  • WAVE_WAVE (wave reference waves)
  • DFREF_WAVE (datafolder reference waves)
  • NT_FP64|NT_COMPLEX (double precision complex waves)
  • NT_FP32|NT_COMPLEX (single precision complex waves)

All wave type checking tests (IsTextWave, IsNumericWave, IsWaveRefWave, IsFloatingPointWave, IsDoubleFloatingPointWave, IsSingleFloatingPointWave, IsComplexWave) use this comprehensive data generator with multi-data test case approach:

  • Tests receive actual wave references from the data generator
  • Use WaveType() to dynamically determine expected results based on actual wave properties
  • All waves are created with /N=0 flag to ensure they are truly empty (0 size) for efficient testing
  • More efficient as waves are created once in the data generator rather than on each test iteration
  • Cleaner implementation without switch/case logic for wave creation
  • Comprehensive coverage across all Igor Pro wave types including 64-bit integers, complex waves, and datafolder reference waves

Implementation Fixes

Fixed IsComplexWave() in MIES_Utilities_Checks.ipf to return proper boolean values (0 or 1) using the !! operator instead of returning raw bitmask values. This ensures consistency with the function's docstring ("Return 1 if the wave is a complex wave") and matches the behavior of other similar IsXXX functions.

Case Sensitivity Testing

Added comprehensive tests for ListHasOnlyOneUniqueEntry to verify case-insensitive behavior, confirming that different cases (e.g., "a" vs "A") are treated as the same entry since cmpstr() is case-insensitive in Igor Pro.

Tests follow existing patterns with section markers and cover edge cases (NaN/Inf handling, null/empty strings, wave type boundaries, case insensitivity).

Removed comment block listing missing tests (lines 6-28).

Original prompt

This section details on the original issue you should resolve

<issue_title>Add unit tests for UTF_Utils_Checks.ipf</issue_title>
<issue_description>The file UTF_Utils_Checks.ipf has a list of commented out functions at the top. These functions are missing unit tests. Please write them and add them to the end of the file. Only make one PR.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI assigned Copilot and t-b Feb 2, 2026
Copilot AI changed the title [WIP] Add unit tests for UTF_Utils_Checks.ipf Add unit tests for 22 utility functions in UTF_Utils_Checks.ipf Feb 2, 2026
Copilot AI requested a review from t-b February 2, 2026 18:25
@t-b
Copy link
Collaborator

t-b commented Feb 2, 2026

@copilot Please use for the IsXXXWave tests the data generator GetSupportedWaveTypes and the multi data test case approach. See https://docs.byte-physics.de/igortest/advanced.html#multi-multi-data-test-cases for some documentation.

Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot Please use for the IsXXXWave tests the data generator GetSupportedWaveTypes and the multi data test case approach. See https://docs.byte-physics.de/igortest/advanced.html#multi-multi-data-tes...

Updated all IsXXXWave tests to use the GetSupportedWaveTypes data generator with multi-data test case approach. The tests now iterate through all supported wave types (NT_FP64, NT_FP32, NT_I32, NT_I16, NT_I8, unsigned variants, TEXT_WAVE, WAVE_WAVE) and verify correct behavior for each type. Commit: 83cd534

@t-b
Copy link
Collaborator

t-b commented Feb 2, 2026

@copilot The new tests code does not compile because waves of different types can't have the same name in one function. Please fix it. Also avoid having the same code in multiple switch cases.

Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot The new tests code does not compile because waves of different types can't have the same name in one function. Please fix it. Also avoid having the same code in multiple switch cases.

Fixed compilation issues by using unique wave names (wvText, wvWave) with generic WAVE references, and reduced code duplication by using expected value patterns and moving CHECK assertions outside switch statements. Commit: c13b14d

@t-b
Copy link
Collaborator

t-b commented Feb 2, 2026

@copilot Please also test with different upper/lower case in the tests for ListHasOnlyOneUniqueEntry.

Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot Please also test with different upper/lower case in the tests for ListHasOnlyOneUniqueEntry.

Added case sensitivity tests for ListHasOnlyOneUniqueEntry. The new test function LHOUE_WorksWithDifferentCase() verifies that different cases are treated as distinct entries (e.g., "a" vs "A"), and that same-case entries are correctly identified as matching. Commits: 45f33ba, 543357a

@t-b
Copy link
Collaborator

t-b commented Feb 2, 2026

@copilot Please write a new data generator which returns a wave reference wave which holds an empty wave of each in Igor Pro supported wave type. Use then this data generator for the IsXXXWave tests.

@t-b
Copy link
Collaborator

t-b commented Feb 2, 2026

@copilot The new test case LHOUE_WorksWithDifferentCase fails as cmpstr is case insensitive in Igor Pro.

@t-b
Copy link
Collaborator

t-b commented Feb 2, 2026

@copilot Please try the last two tasks again as you aborted.

@t-b
Copy link
Collaborator

t-b commented Feb 3, 2026

@copilot Please work on #2615 (comment) and #2615 (comment).

Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot Please work on #2615 (comment) and #2615 (comment).

Implemented both requested changes:

  1. Created GetEmptyWavesOfAllTypes() data generator that returns a wave reference wave holding empty waves of all 10 supported Igor Pro wave types. Updated all IsXXXWave tests to use this new data generator instead of string-based type names.

  2. Fixed LHOUE_WorksWithDifferentCase() test to correctly reflect that cmpstr() is case-insensitive in Igor Pro (changed expectations from CHECK(!...) to CHECK(...) for different case comparisons).

Commits: 35f5211, b13d0c6

@t-b
Copy link
Collaborator

t-b commented Feb 3, 2026

@copilot GetEmptyWavesOfAllTypes is missing datafolder reference waves and complex waves.

@t-b t-b force-pushed the copilot/add-unit-tests-utf-utils-checks branch 2 times, most recently from 24b0056 to 3e7e5e4 Compare February 3, 2026 15:13
@t-b t-b marked this pull request as ready for review February 3, 2026 15:14
Copilot AI review requested due to automatic review settings February 3, 2026 15:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit test coverage for utility check functions and introduces a shared test data generator for exercising wave-type predicates across supported Igor wave types.

Changes:

  • Added unit tests in UTF_Utils_Checks.ipf for numeric/string/wave-type utility checks previously lacking coverage.
  • Introduced GetEmptyWavesOfAllTypes() data generator to provide empty waves of many supported types for multi-data tests.
  • Adjusted a few implementations in MIES_Utilities_Checks.ipf (bitmask-to-boolean returns for float-type checks; case-insensitive reverse search for StringEndsWith).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
Packages/tests/UTF_DataGenerators.ipf Adds GetEmptyWavesOfAllTypes() to supply comprehensive wave-type fixtures for tests.
Packages/tests/Basic/UTF_Utils_Checks.ipf Adds the new unit tests for the missing utility functions, including multi-data wave-type tests.
Packages/MIES/MIES_Utilities_Checks.ipf Updates some utility implementations to align with boolean semantics and case-insensitive suffix matching.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@t-b t-b force-pushed the copilot/add-unit-tests-utf-utils-checks branch 2 times, most recently from 7fb0fa2 to c2c0122 Compare February 3, 2026 15:40
@t-b t-b unassigned Copilot Feb 3, 2026
@t-b t-b force-pushed the copilot/add-unit-tests-utf-utils-checks branch from c2c0122 to 7154f07 Compare February 3, 2026 15:53
t-b added 2 commits February 3, 2026 16:55
…ve: Fix return value for complex waves

We only want to return 0 or 1. and not the numeric type.
@t-b t-b force-pushed the copilot/add-unit-tests-utf-utils-checks branch from 7154f07 to 3772463 Compare February 3, 2026 15:55
@t-b t-b force-pushed the copilot/add-unit-tests-utf-utils-checks branch from 3772463 to 0f33e11 Compare February 3, 2026 15:57
@t-b t-b self-requested a review February 3, 2026 15:58
@t-b t-b closed this Feb 3, 2026
@t-b t-b reopened this Feb 3, 2026
@t-b
Copy link
Collaborator

t-b commented Feb 3, 2026

Closing in favour of #2617 as CI is not running here.

@t-b t-b closed this Feb 3, 2026
@t-b t-b deleted the copilot/add-unit-tests-utf-utils-checks branch February 3, 2026 16:34
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.

Add unit tests for UTF_Utils_Checks.ipf

2 participants