Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Dec 22, 2024
1 parent bf91d28 commit 947de2a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Testing/GoogleTest/ByteCompare/ByteCompare_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,52 @@ namespace

FilePair pair(filename_left, filename_right);

EXPECT_EQ(DIFFCODE::TEXT | DIFFCODE::DIFF, bc.CompareFiles(&pair.diffData));
}
}
for (int i = 0; i < 3; i++)
{
{// diff left: CRLF - right: no EOL
std::vector<char> buf_left(WMCMPBUFF * 2 + 2 + i);
std::vector<char> buf_right(WMCMPBUFF * 2 + i);

memset(buf_left.data(), 'A', buf_left.size());
memset(buf_right.data(), 'A', buf_right.size());

buf_left[10] = '\r';
buf_left[11] = '\n';
buf_right[10] = '\r';
buf_right[11] = '\n';
buf_left[buf_left.size() - 2] = '\r';
buf_left[buf_left.size() - 1] = '\n';

TempFile file_left(filename_left, buf_left.data(), buf_left.size());
TempFile file_right(filename_right, buf_right.data(), buf_right.size());

FilePair pair(filename_left, filename_right);

EXPECT_EQ(DIFFCODE::TEXT | DIFFCODE::DIFF, bc.CompareFiles(&pair.diffData));
}

{// diff left: no EOL - right: CRLF
std::vector<char> buf_left(WMCMPBUFF * 2 + i);
std::vector<char> buf_right(WMCMPBUFF * 2 + 2 + i);

memset(buf_left.data(), 'A', buf_left.size());
memset(buf_right.data(), 'A', buf_right.size());

buf_left[10] = '\r';
buf_left[11] = '\n';
buf_right[10] = '\r';
buf_right[11] = '\n';
buf_right[buf_right.size() - 2] = '\r';
buf_right[buf_right.size() - 1] = '\n';

TempFile file_left(filename_left, buf_left.data(), buf_left.size());
TempFile file_right(filename_right, buf_right.data(), buf_right.size());

FilePair pair(filename_left, filename_right);

EXPECT_EQ(DIFFCODE::TEXT | DIFFCODE::DIFF, bc.CompareFiles(&pair.diffData));
}
}
Expand Down

0 comments on commit 947de2a

Please sign in to comment.