mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Replaced test values for hexfloat and printf to avoid ambiguity (#2425)
Fixes #1335 according to the issue description. @alycm replaced with straightforward values in terms of hex float representation
This commit is contained in:
@@ -70,14 +70,15 @@ struct printDataGenParameters
|
|||||||
{
|
{
|
||||||
std::vector<std::string> genericFormats;
|
std::vector<std::string> genericFormats;
|
||||||
const char* dataRepresentation;
|
const char* dataRepresentation;
|
||||||
const char* vectorFormatFlag;
|
const char* vectorFormatFlag = nullptr;
|
||||||
const char* vectorFormatSpecifier;
|
const char* vectorFormatSpecifier = nullptr;
|
||||||
const char* dataType;
|
const char* dataType = nullptr;
|
||||||
const char* vectorSize;
|
const char* vectorSize = nullptr;
|
||||||
const char* addrSpaceArgumentTypeQualifier;
|
const char* addrSpaceArgumentTypeQualifier = nullptr;
|
||||||
const char* addrSpaceVariableTypeQualifier;
|
const char* addrSpaceVariableTypeQualifier = nullptr;
|
||||||
const char* addrSpaceParameter;
|
const char* addrSpaceParameter = nullptr;
|
||||||
const char* addrSpacePAdd;
|
const char* addrSpacePAdd = nullptr;
|
||||||
|
bool allowFallbackTest = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reference results - filled out at run-time
|
// Reference results - filled out at run-time
|
||||||
@@ -111,6 +112,9 @@ struct testCase
|
|||||||
char*,
|
char*,
|
||||||
const size_t); //function pointer for generating reference results
|
const size_t); //function pointer for generating reference results
|
||||||
Type dataType; //the data type that will be printed during reference result generation (used for setting rounding mode)
|
Type dataType; //the data type that will be printed during reference result generation (used for setting rounding mode)
|
||||||
|
bool (*fallbackTestFN)(const char*,
|
||||||
|
const char*) =
|
||||||
|
nullptr; // function pointer to perform fallback test if required
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char* strType[];
|
extern const char* strType[];
|
||||||
|
|||||||
@@ -26,8 +26,11 @@ static void intRefBuilder(printDataGenParameters&, char*, const size_t);
|
|||||||
static void halfRefBuilder(printDataGenParameters&, char* rResult,
|
static void halfRefBuilder(printDataGenParameters&, char* rResult,
|
||||||
const size_t);
|
const size_t);
|
||||||
static void floatRefBuilder(printDataGenParameters&, char* rResult, const size_t);
|
static void floatRefBuilder(printDataGenParameters&, char* rResult, const size_t);
|
||||||
|
static bool floatRefTest(const char* refResult, const char* analysisBuffer);
|
||||||
static void doubleRefBuilder(printDataGenParameters&, char* rResult,
|
static void doubleRefBuilder(printDataGenParameters&, char* rResult,
|
||||||
const size_t);
|
const size_t);
|
||||||
|
static bool doubleRefTest(const char* refResult, const char* analysisBuffer);
|
||||||
|
|
||||||
static void octalRefBuilder(printDataGenParameters&, char*, const size_t);
|
static void octalRefBuilder(printDataGenParameters&, char*, const size_t);
|
||||||
static void unsignedRefBuilder(printDataGenParameters&, char*, const size_t);
|
static void unsignedRefBuilder(printDataGenParameters&, char*, const size_t);
|
||||||
static void hexRefBuilder(printDataGenParameters&, char*, const size_t);
|
static void hexRefBuilder(printDataGenParameters&, char*, const size_t);
|
||||||
@@ -468,12 +471,12 @@ std::vector<printDataGenParameters> printFloatGenParameters = {
|
|||||||
|
|
||||||
// Double argument representing floating-point,in [-]xh.hhhhpAd style
|
// Double argument representing floating-point,in [-]xh.hhhhpAd style
|
||||||
|
|
||||||
{ { "%.6a" }, "0.1f" },
|
{ { "%.6a" }, "0.5f", 0, 0, 0, 0, 0, 0, 0, 0, true },
|
||||||
|
|
||||||
//(Minimum)Ten-wide,Double argument representing floating-point,in
|
//(Minimum)Ten-wide,Double argument representing floating-point,in
|
||||||
// xh.hhhhpAd style,default(right)-justified
|
// xh.hhhhpAd style,default(right)-justified
|
||||||
|
|
||||||
{ { "%10.2a" }, "9990.235f" },
|
{ { "%10.2a" }, "1.5f", 0, 0, 0, 0, 0, 0, 0, 0, true },
|
||||||
|
|
||||||
//(Minimum)Ten-wide,two positions after the decimal,with
|
//(Minimum)Ten-wide,two positions after the decimal,with
|
||||||
// a blank space inserted before the value, default(right)-justified
|
// a blank space inserted before the value, default(right)-justified
|
||||||
@@ -502,8 +505,9 @@ testCase testCaseFloat = {
|
|||||||
|
|
||||||
floatRefBuilder,
|
floatRefBuilder,
|
||||||
|
|
||||||
kfloat
|
kfloat,
|
||||||
|
|
||||||
|
floatRefTest
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================
|
//==============================================
|
||||||
@@ -673,12 +677,12 @@ std::vector<printDataGenParameters> printDoubleGenParameters = {
|
|||||||
|
|
||||||
// Double argument representing floating-point,in [-]xh.hhhhpAd style
|
// Double argument representing floating-point,in [-]xh.hhhhpAd style
|
||||||
|
|
||||||
{ { "%.6a" }, "0.1" },
|
{ { "%.6a" }, "0.5", 0, 0, 0, 0, 0, 0, 0, 0, true },
|
||||||
|
|
||||||
//(Minimum)Ten-wide,Double argument representing floating-point,in
|
//(Minimum)Ten-wide,Double argument representing floating-point,in
|
||||||
// xh.hhhhpAd style,default(right)-justified
|
// xh.hhhhpAd style,default(right)-justified
|
||||||
|
|
||||||
{ { "%10.2a" }, "9990.235" },
|
{ { "%10.2a" }, "1.5", 0, 0, 0, 0, 0, 0, 0, 0, true },
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
@@ -697,8 +701,9 @@ testCase testCaseDouble = {
|
|||||||
|
|
||||||
doubleRefBuilder,
|
doubleRefBuilder,
|
||||||
|
|
||||||
kdouble
|
kdouble,
|
||||||
|
|
||||||
|
doubleRefTest
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================
|
//==============================================
|
||||||
@@ -1757,7 +1762,15 @@ size_t verifyOutputBuffer(char *analysisBuffer,testCase* pTestCase,size_t testId
|
|||||||
return !std::regex_match(analysisBuffer, nanRegex);
|
return !std::regex_match(analysisBuffer, nanRegex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return strcmp(analysisBuffer, pTestCase->_correctBuffer[testId].c_str());
|
size_t ret =
|
||||||
|
strcmp(analysisBuffer, pTestCase->_correctBuffer[testId].c_str());
|
||||||
|
|
||||||
|
if (ret != 0 && pTestCase->_genParameters[testId].allowFallbackTest
|
||||||
|
&& pTestCase->fallbackTestFN)
|
||||||
|
if (pTestCase->fallbackTestFN(
|
||||||
|
analysisBuffer, pTestCase->_correctBuffer[testId].c_str()))
|
||||||
|
return 0;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void intRefBuilder(printDataGenParameters& params, char* refResult, const size_t refSize)
|
static void intRefBuilder(printDataGenParameters& params, char* refResult, const size_t refSize)
|
||||||
@@ -1781,6 +1794,13 @@ static void floatRefBuilder(printDataGenParameters& params, char* refResult, con
|
|||||||
strtof(params.dataRepresentation, NULL));
|
strtof(params.dataRepresentation, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool floatRefTest(const char* refResult, const char* analysisBuffer)
|
||||||
|
{
|
||||||
|
float test = strtof(analysisBuffer, NULL);
|
||||||
|
float expected = strtof(refResult, NULL);
|
||||||
|
return test == expected;
|
||||||
|
}
|
||||||
|
|
||||||
static void doubleRefBuilder(printDataGenParameters& params, char* refResult,
|
static void doubleRefBuilder(printDataGenParameters& params, char* refResult,
|
||||||
const size_t refSize)
|
const size_t refSize)
|
||||||
{
|
{
|
||||||
@@ -1788,6 +1808,13 @@ static void doubleRefBuilder(printDataGenParameters& params, char* refResult,
|
|||||||
strtod(params.dataRepresentation, NULL));
|
strtod(params.dataRepresentation, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool doubleRefTest(const char* refResult, const char* analysisBuffer)
|
||||||
|
{
|
||||||
|
double test = strtod(analysisBuffer, NULL);
|
||||||
|
double expected = strtod(refResult, NULL);
|
||||||
|
return test == expected;
|
||||||
|
}
|
||||||
|
|
||||||
static void octalRefBuilder(printDataGenParameters& params, char* refResult, const size_t refSize)
|
static void octalRefBuilder(printDataGenParameters& params, char* refResult, const size_t refSize)
|
||||||
{
|
{
|
||||||
const unsigned long int data = strtoul(params.dataRepresentation, NULL, 10);
|
const unsigned long int data = strtoul(params.dataRepresentation, NULL, 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user