Add test showing bug in IsProbablyDuplicate()
This commit is contained in:
@@ -22,6 +22,28 @@ bool DistinctIndices(const FullStepRow<WIDTH>& a, const FullStepRow<WIDTH>& b, s
|
||||
return true;
|
||||
}
|
||||
|
||||
template<size_t MAX_INDICES>
|
||||
bool IsProbablyDuplicate(std::shared_ptr<eh_trunc> indices, size_t lenIndices)
|
||||
{
|
||||
assert(lenIndices <= MAX_INDICES);
|
||||
bool checked_index[MAX_INDICES] = {false};
|
||||
bool count_checked = 0;
|
||||
for (int z = 0; z < lenIndices; z++) {
|
||||
// Skip over indices we have already paired
|
||||
if (!checked_index[z]) {
|
||||
for (int y = z+1; y < lenIndices; y++) {
|
||||
if (!checked_index[y] && indices.get()[z] == indices.get()[y]) {
|
||||
// Pair found
|
||||
checked_index[y] = true;
|
||||
count_checked += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count_checked == lenIndices;
|
||||
}
|
||||
|
||||
template<size_t WIDTH>
|
||||
bool IsValidBranch(const FullStepRow<WIDTH>& a, const size_t len, const unsigned int ilen, const eh_trunc t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user