Skip to content

Conversation

@kabrahamAMD
Copy link
Contributor

@kabrahamAMD kabrahamAMD commented Oct 21, 2025

This PR adds new testing functionality: an inline diff for string comparison.

Example usage:

EXPECT_THAT("Actual string", ck_tile::test::StringEqWithDiff("Expected string"));

Failure message:

Value of: "Actual string"
Expected: "Expected string"
Actual: "Actual string" (of type char [14]),
Diff: "[Expe|A]ct[ed|ual] string"

The inline-diff function uses the Wagner-Fischer algorithm to find the minimum edit distance and generate diff markers, which has O(N^2) complexity. It has optional color codes that are enabled with the matcher.

@kabrahamAMD kabrahamAMD force-pushed the kabraham/builder-inline-diff branch from c3fe4ef to 18e8161 Compare October 21, 2025 08:28
@Snektron Snektron changed the title Kabraham/builder inline diff [CK_BUILDER] builder inline diff Oct 22, 2025
@kabrahamAMD kabrahamAMD force-pushed the kabraham/builder-inline-diff branch 2 times, most recently from f6dffc6 to c7d3403 Compare October 22, 2025 09:37
@shumway shumway changed the title [CK_BUILDER] builder inline diff [CK_BUILDER] builder Oct 23, 2025
#include <ck/utility/sequence.hpp>

namespace ck_tile::builder {

Copy link
Collaborator

Choose a reason for hiding this comment

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

It’s not clear to me why we are including this file in this PR. I don’t think we’re using any of it for inline_diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, I didn't mean the include. Why are we adding the file builder_utils.h in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's being included by test_builder_utils.cpp, which is using to_sequence_v, among others

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it, see comment below

Snektron
Snektron previously approved these changes Oct 23, 2025
@shumway shumway changed the title [CK_BUILDER] builder [CK_BUILDER] Add inline string diff for tests Oct 24, 2025
EXPECT_TRUE((std::is_same_v<result_seq, expected_seq>));
}

TEST(BuilderUtils, StringLiteral)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test called BuilderUtils - StringLiteral? This is not what the test is. It shouldn't go in the file test_builder_utils.hpp, either.

The only files should be testing_utils.hpp, testing_utils.cpp, and the test for them, test_testing_utils.cpp. Builder utils don't belong here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, it looks like my might not have pushed the latest changes you have. Your comments look like they may be ahead of the code in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I just realized what happened here... I was looking at the diff vs. the branch you were pointing me to, and there was a test where strings were being compared. I assumed that was supposed to be the test for the inlineDiff function, and worked from there. But apparently this was the test for the builder_utils StringLiteral feature. That also explains the dependency on builder_utils from the two other tests in the comment above

@kabrahamAMD kabrahamAMD force-pushed the kabraham/builder-inline-diff branch from 5e7c9d4 to 9e744d5 Compare October 24, 2025 18:40
Copy link
Collaborator

@shumway shumway left a comment

Choose a reason for hiding this comment

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

Thanks, looks great!

@shumway shumway merged commit e576992 into develop Oct 25, 2025
48 checks passed
@shumway shumway deleted the kabraham/builder-inline-diff branch October 25, 2025 14:22
shumway pushed a commit that referenced this pull request Oct 25, 2025
Adds new testing functionality: an inline diff for string comparison.

Example usage:

EXPECT_THAT("Actual string", ck_tile::test::StringEqWithDiff("Expected string"));

Failure message:

Value of: "Actual string"
Expected: "Expected string"
Actual: "Actual string" (of type char [14]),
Diff: "[Expe|A]ct[ed|ual] string"

The inline-diff function uses the Wagner-Fischer algorithm to find the minimum edit distance and generate diff markers, which has O(N^2) complexity. It has optional color codes that are enabled with the matcher.
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.

4 participants