| 56 | |
| 57 | |
| 58 | static void CheckRawTarget(ERawTargetType targetType, const TVector<TRawTarget>& target, ui32 objectCount) { |
| 59 | CB_ENSURE_INTERNAL( |
| 60 | !target.empty() || (targetType == ERawTargetType::None), |
| 61 | "Target data is specified but targetType is None" |
| 62 | ); |
| 63 | |
| 64 | for (auto i : xrange(target.size())) { |
| 65 | if (const ITypedSequencePtr<float>* typedSequence = std::get_if<ITypedSequencePtr<float>>(&target[i])) { |
| 66 | CB_ENSURE_INTERNAL( |
| 67 | (targetType == ERawTargetType::Boolean) || |
| 68 | (targetType == ERawTargetType::Float) || |
| 69 | (targetType == ERawTargetType::Integer), |
| 70 | "target data contains float values but targetType is " << targetType |
| 71 | ); |
| 72 | CheckDataSize( |
| 73 | (*typedSequence)->GetSize(), |
| 74 | objectCount, |
| 75 | "Target[" + ToString(i) + "]", |
| 76 | false |
| 77 | ); |
| 78 | if (targetType == ERawTargetType::Boolean) { |
| 79 | CheckContainsOnly01s(**typedSequence); |
| 80 | } else if (targetType == ERawTargetType::Integer) { |
| 81 | CheckContainsOnlyIntegers(**typedSequence); |
| 82 | } |
| 83 | } else { |
| 84 | CB_ENSURE_INTERNAL( |
| 85 | targetType == ERawTargetType::String, |
| 86 | "target data contains float values but targetType is " << targetType |
| 87 | ); |
| 88 | const TVector<TString>& stringVector = std::get<TVector<TString>>(target[i]); |
| 89 | CheckDataSize(stringVector.size(), (size_t)objectCount, "Target[" + ToString(i) + "]", false); |
| 90 | for (auto j : xrange(stringVector.size())) { |
| 91 | CB_ENSURE(!stringVector[j].empty(), "Target[" << i << ", " << j << "] is empty"); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | |
| 98 | static void CheckOneBaseline(TConstArrayRef<float> baseline, size_t idx, ui32 objectCount) { |
no test coverage detected