Commit 00b5a97b authored by Eric Cano's avatar Eric Cano
Browse files

Moved definition of compiler flags so they become active. This fixes the lack...

Moved definition of compiler flags so they become active. This fixes the lack of debug info in SLC6.
Fixed superflous semicolon detected by -pedantic
Fixed sign correctness in various places.
Removed the use of LL suffix in 64 bits contants (they are not required).
Some documentation clarifications.
parent 550ad611
......@@ -42,6 +42,11 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
project (CERN_Tape)
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
###########################################################################
# compiler options
###########################################################################
set (CMAKE_CXX_FLAGS "-g3 -Wall -Werror -pedantic")
###########################################################################
# dependancies
###########################################################################
......@@ -72,12 +77,6 @@ add_subdirectory(Utils)
# .. and of course, the tests (last to use the variable definition)
add_subdirectory(test)
###########################################################################
# compiler options
###########################################################################
set (CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -Wall -Werror -pedantic”)
###########################################################################
# documentation
###########################################################################
......
......@@ -301,10 +301,11 @@ The SCSI commands and st driver's functions used in previous software (CAStor's
\end{itemize}
\item st driver's commands, leading to internal variables setting or SCSI actions:
\begin{itemize}
\item Get internal driver state via the MTIOGET ioctl (for drivre ready, write protection,
\item Get internal driver state via the MTIOGET ioctl (for drive ready, write protection,
get some error condition, when MTIOSENSE failed, to get the EOD, BOT bits (readlbl)).
This functionality is covered by \verb#Drive::getDriveStatus#.
\item Try and get the sense data for the last-ish command with MTIOSENSE. This
relies on a CERN-made patch.
relies on a CERN-made patch. This is also covered \verb#Drive::getDriveStatus#.
\item Setup the driver's parameters (MTIOCTOP/MTSETDRVBUFFER) for (un)buffered
writes and asynchronous writes (in confdrive, a child of taped).
TODO: check underlying.
......
......@@ -98,8 +98,8 @@ namespace Tape {
template <class sysWrapperClass>
class Drive {
public:
Drive(SCSI::DeviceInfo di, sysWrapperClass & sw): m_sysWrapper(sw),
m_SCSIInfo(di), m_tapeFD(-1), m_genericFD(-1)
Drive(SCSI::DeviceInfo di, sysWrapperClass & sw): m_SCSIInfo(di),
m_tapeFD(-1), m_genericFD(-1), m_sysWrapper(sw)
{
/* Open the device files */
/* We open the tape device file non-blocking as blocking open on rewind tapes (at least)
......@@ -255,7 +255,7 @@ namespace Tape {
/* Return the ACTIVE tape alerts (this is indicated by "flag" (see
* SSC-4: 8.2.3 TapeAlert log page). As they are simply used for logging;
* return strings. */
for (int i=0; i< tal.parameterNumber(); i++) {
for (size_t i=0; i< tal.parameterNumber(); i++) {
if (tal.parameters[i].flag)
ret.push_back(SCSI::tapeAlertToString(
SCSI::Structures::toU16(tal.parameters[i].parameterCode)
......@@ -363,6 +363,10 @@ namespace Tape {
*/
virtual tapeError getTapeError() throw (Exception) { throw Exception("Not implemented"); }
/**
*
*/
virtual ~Drive() {
if(-1 != m_tapeFD)
m_sysWrapper.close(m_tapeFD);
......
......@@ -80,7 +80,7 @@ Tape::Exceptions::Backtrace::Backtrace() {
m_trace = "";
else {
std::stringstream trc;
for (int i=0; i<depth; i++) {
for (size_t i=0; i<depth; i++) {
std::string line(strings[i]);
/* Demangle the c++, if possible. We expect the c++ function name's to live
* between a '(' and a +
......
......@@ -322,4 +322,4 @@ namespace SCSI {
};
static const struct error_range_info ascRangesStrings[];
};
}; // namespace SCSI
} // namespace SCSI
......@@ -260,4 +260,4 @@ namespace SCSI {
private:
int m_fd;
}; // class Device
}; /* namespace SCSI */
} /* namespace SCSI */
......@@ -66,7 +66,7 @@ TEST(DeviceList, ScansCorrectly) {
SCSI::DeviceVector<Tape::System::virtualWrapper> dl(sysWrapper);
ASSERT_EQ(3, dl.size());
ASSERT_EQ(3U, dl.size());
ASSERT_EQ(SCSI::Types::mediumChanger, dl[0].type);
ASSERT_EQ(SCSI::Types::tape, dl[1].type);
ASSERT_EQ(SCSI::Types::tape, dl[2].type);
......@@ -102,4 +102,4 @@ TEST(DeviceList, ScansCorrectly) {
ASSERT_EQ(129, dl[2].nst.minor);
}
};
}
......@@ -673,8 +673,8 @@ namespace SCSI {
* length in bytes (as found in the struct) in a parameter count.
* @return number of parameters.
*/
int parameterNumber() throw (Tape::Exception) {
int numFromLength = SCSI::Structures::toU16(pageLength) / sizeof (tapeAlertLogParameter_t);
unsigned int parameterNumber() throw (Tape::Exception) {
unsigned int numFromLength = SCSI::Structures::toU16(pageLength) / sizeof (tapeAlertLogParameter_t);
return numFromLength;
}
};
......@@ -838,7 +838,7 @@ namespace SCSI {
std::string hexDump(const unsigned char(& d)[n]) {
std::stringstream hex;
hex << std::hex << std::setfill('0');
int pos = 0;
size_t pos = 0;
while (pos < (8* (n / 8))) {
hex << std::setw(4) << pos << " | ";
for (int i=0; i<8; i++)
......@@ -851,17 +851,17 @@ namespace SCSI {
}
if (n % 8) {
hex << std::setw(4) << pos << " | ";
for (int i=0; i<(n % 8); i++)
for (size_t i=0; i<(n % 8); i++)
hex << std::setw(2) << ((int) d[pos + i]) << " ";
for (int i=(n % 8); i<8; i++)
for (size_t i=(n % 8); i<8; i++)
hex << " ";
hex << "| ";
for (int i=0; i<(n % 8); i++)
for (size_t i=0; i<(n % 8); i++)
hex << std::setw(0) << d[pos + i];
hex << std::endl;
}
return hex.str();
}
};
};
}
}
......@@ -112,7 +112,7 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(6, sizeof(inqCDB));
ASSERT_EQ(6U, sizeof(inqCDB));
ASSERT_EQ(SCSI::Commands::INQUIRY, inqCDB.opCode);
buff[0] = 0;
......@@ -135,7 +135,7 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(10, sizeof(logSelectCDB));
ASSERT_EQ(10U, sizeof(logSelectCDB));
ASSERT_EQ(SCSI::Commands::LOG_SELECT, logSelectCDB.opCode);
buff[0] = 0xAB;
......@@ -164,7 +164,7 @@ namespace UnitTests {
to the original structure (virtual table, for example)*/
sg_io_hdr_t & sgio_hdr = *(sg_io_hdr_t *)&lsg;
/* Also make sure the constructor does its initialization job */
ASSERT_EQ(30000, sgio_hdr.timeout);
ASSERT_EQ(30000U, sgio_hdr.timeout);
ASSERT_EQ('S', sgio_hdr.interface_id);
/* The rest is safe. It's just a struct with added functions */
}
......@@ -177,7 +177,7 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(10, sizeof(logSenseCDB));
ASSERT_EQ(10U, sizeof(logSenseCDB));
/* Check proper initialization an location of struct members match
the bit/byte locations defined in SPC-4 */
......@@ -226,7 +226,7 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(10, sizeof(locate10CDB)); // that is why it called locate 10
ASSERT_EQ(10U, sizeof(locate10CDB)); // that is why it called locate 10
/* Check proper initialization an location of struct members match
the bit/byte locations defined in SPC-4 */
......@@ -246,9 +246,9 @@ namespace UnitTests {
buff[1] |= (0x1 & 0xF) << 2;
ASSERT_EQ(1, locate10CDB.BT);
ASSERT_EQ(0, SCSI::Structures::toU32(locate10CDB.logicalObjectID));
ASSERT_EQ(0U, SCSI::Structures::toU32(locate10CDB.logicalObjectID));
buff[3] |= 0x0A;buff[4] |= 0xBC;buff[5] |= 0xDE;buff[6] |= 0xF0;
ASSERT_EQ(0x0ABCDEF0, SCSI::Structures::toU32(locate10CDB.logicalObjectID));
ASSERT_EQ(0x0ABCDEF0U, SCSI::Structures::toU32(locate10CDB.logicalObjectID));
ASSERT_EQ(0, locate10CDB.partition);
buff[8] = 0xAB;
......@@ -266,7 +266,7 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(10, sizeof(readPositionCDB));
ASSERT_EQ(10U, sizeof(readPositionCDB));
/* Check proper initialization an location of struct members match
the bit/byte locations defined in SPC-4 */
......@@ -293,7 +293,7 @@ namespace UnitTests {
SCSI::Structures::readPositionDataShortForm_t readPositionData;
unsigned char *buff = (unsigned char *)&readPositionData;
ASSERT_EQ(20, sizeof(readPositionData));
ASSERT_EQ(20U, sizeof(readPositionData));
ASSERT_EQ(0, readPositionData.BPEW);
buff[0] |= (0x1 & 0xFF) << 0;
......@@ -323,21 +323,21 @@ namespace UnitTests {
buff[2] |= 0xFF; buff[3] = 0xFF;
ASSERT_EQ(0, SCSI::Structures::toU32(readPositionData.firstBlockLocation));
ASSERT_EQ(0U, SCSI::Structures::toU32(readPositionData.firstBlockLocation));
buff[4] |= 0x0A;buff[5] |= 0xBC;buff[6] |= 0xDE;buff[7] |= 0xF0;
ASSERT_EQ(0x0ABCDEF0, SCSI::Structures::toU32(readPositionData.firstBlockLocation));
ASSERT_EQ(0x0ABCDEF0U, SCSI::Structures::toU32(readPositionData.firstBlockLocation));
ASSERT_EQ(0, SCSI::Structures::toU32(readPositionData.lastBlockLocation));
ASSERT_EQ(0U, SCSI::Structures::toU32(readPositionData.lastBlockLocation));
buff[8] |= 0x9A;buff[9] |= 0xBC;buff[10] |= 0xDE;buff[11] |= 0xF9;
ASSERT_EQ(0x9ABCDEF9, SCSI::Structures::toU32(readPositionData.lastBlockLocation));
ASSERT_EQ(0x9ABCDEF9U, SCSI::Structures::toU32(readPositionData.lastBlockLocation));
buff[12] |= 0xFF;
ASSERT_EQ(0, SCSI::Structures::toU32(readPositionData.blocksInBuffer));
ASSERT_EQ(0U, SCSI::Structures::toU32(readPositionData.blocksInBuffer));
buff[13] |= 0x9A;buff[14] |= 0xBC;buff[15] |= 0xDE;
ASSERT_EQ(0x009ABCDE, SCSI::Structures::toU32(readPositionData.blocksInBuffer));
ASSERT_EQ(0x009ABCDEU, SCSI::Structures::toU32(readPositionData.blocksInBuffer));
ASSERT_EQ(0, SCSI::Structures::toU32(readPositionData.bytesInBuffer));
ASSERT_EQ(0U, SCSI::Structures::toU32(readPositionData.bytesInBuffer));
buff[16] |= 0x7A;buff[17] |= 0xBC;buff[18] |= 0xDE;buff[19] |= 0xF7;
ASSERT_EQ(0x7ABCDEF7, SCSI::Structures::toU32(readPositionData.bytesInBuffer));
ASSERT_EQ(0x7ABCDEF7U, SCSI::Structures::toU32(readPositionData.bytesInBuffer));
}
TEST(SCSI_Structures, modeSelect6CDB_t) {
......@@ -347,27 +347,27 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(6, sizeof(modeSelect6CDB));
ASSERT_EQ(6U, sizeof(modeSelect6CDB));
/* Check proper initialization an location of struct members match
the bit/byte locations defined in SPC-4 */
ASSERT_EQ(SCSI::Commands::MODE_SELECT_6, modeSelect6CDB.opCode);
buff[0] = 0xAB;
ASSERT_EQ(0xAB, modeSelect6CDB.opCode);
ASSERT_EQ(0xABU, modeSelect6CDB.opCode);
ASSERT_EQ(0, modeSelect6CDB.SP);
buff[1] |= (0x1 & 0xFF) << 0;
ASSERT_EQ(0x1, modeSelect6CDB.SP);
ASSERT_EQ(0x1U, modeSelect6CDB.SP);
ASSERT_EQ(0, modeSelect6CDB.PF);
ASSERT_EQ(0U, modeSelect6CDB.PF);
buff[1] |= (0x10 & 0xFF) << 0;
ASSERT_EQ(0x1, modeSelect6CDB.PF);
ASSERT_EQ(0x1U, modeSelect6CDB.PF);
buff[2] |= 0xFF; buff[3] = 0xFF;
ASSERT_EQ(0, modeSelect6CDB.paramListLength);
ASSERT_EQ(0U, modeSelect6CDB.paramListLength);
buff[4] |= 0xBC;
ASSERT_EQ(0xBC, modeSelect6CDB.paramListLength);
ASSERT_EQ(0xBCU, modeSelect6CDB.paramListLength);
ASSERT_EQ(0, modeSelect6CDB.control);
buff[5] |= 0xAB;
......@@ -381,37 +381,37 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(6, sizeof(modeSense6CDB));
ASSERT_EQ(6U, sizeof(modeSense6CDB));
/* Check proper initialization an location of struct members match
the bit/byte locations defined in SPC-4 */
ASSERT_EQ(SCSI::Commands::MODE_SENSE_6, modeSense6CDB.opCode);
buff[0] = 0xAB;
ASSERT_EQ(0xAB, modeSense6CDB.opCode);
ASSERT_EQ(0xABU, modeSense6CDB.opCode);
ASSERT_EQ(0, modeSense6CDB.DBD);
buff[1] |= (0x8 & 0xFF) << 0;
ASSERT_EQ(0x1, modeSense6CDB.DBD);
ASSERT_EQ(0x1U, modeSense6CDB.DBD);
ASSERT_EQ(0, modeSense6CDB.pageCode);
ASSERT_EQ(0U, modeSense6CDB.pageCode);
buff[2] |= (0x2A & 0xFF) << 0;
ASSERT_EQ(0x2A, modeSense6CDB.pageCode);
ASSERT_EQ(0x2AU, modeSense6CDB.pageCode);
ASSERT_EQ(0, modeSense6CDB.PC);
ASSERT_EQ(0u, modeSense6CDB.PC);
buff[2] |= (0x8B & 0xFF) << 0;
ASSERT_EQ(0x2, modeSense6CDB.PC);
ASSERT_EQ(0x2U, modeSense6CDB.PC);
ASSERT_EQ(0, modeSense6CDB.subPageCode);
ASSERT_EQ(0U, modeSense6CDB.subPageCode);
buff[3] |= 0xBC;
ASSERT_EQ(0xBC, modeSense6CDB.subPageCode);
ASSERT_EQ(0xBCU, modeSense6CDB.subPageCode);
ASSERT_EQ(0, modeSense6CDB.allocationLenght);
ASSERT_EQ(0U, modeSense6CDB.allocationLenght);
buff[4] |= 0xAB;
ASSERT_EQ(0xAB, modeSense6CDB.allocationLenght);
ASSERT_EQ(0xABU, modeSense6CDB.allocationLenght);
ASSERT_EQ(0, modeSense6CDB.control);
ASSERT_EQ(0U, modeSense6CDB.control);
buff[5] |= 0xCD;
ASSERT_EQ(0xCD, modeSense6CDB.control);
ASSERT_EQ(0xCDU, modeSense6CDB.control);
}
TEST(SCSI_Structures, modeSenseDeviceConfiguration_t) {
......@@ -421,25 +421,25 @@ namespace UnitTests {
* Make sure this struct is a POD (plain old data without virtual table)
* (and has the right size).
*/
ASSERT_EQ(28, sizeof(devConfig));
ASSERT_EQ(4, sizeof(devConfig.header));
ASSERT_EQ(8, sizeof(devConfig.blockDescriptor));
ASSERT_EQ(16, sizeof(devConfig.modePage));
ASSERT_EQ(28U, sizeof(devConfig));
ASSERT_EQ(4U, sizeof(devConfig.header));
ASSERT_EQ(8U, sizeof(devConfig.blockDescriptor));
ASSERT_EQ(16U, sizeof(devConfig.modePage));
/* We will only check used by us parameters */
ASSERT_EQ(0, devConfig.header.modeDataLength);
ASSERT_EQ(0U, devConfig.header.modeDataLength);
buff[0] |= 0xAB;
ASSERT_EQ(0xAB, devConfig.header.modeDataLength);
ASSERT_EQ(0xABU, devConfig.header.modeDataLength);
buff[1] = buff[2] = buff[3] = 0xFF;
ASSERT_EQ(0, devConfig.blockDescriptor.densityCode);
ASSERT_EQ(0U, devConfig.blockDescriptor.densityCode);
buff[4] |= 0xCD;
ASSERT_EQ(0xCD, devConfig.blockDescriptor.densityCode);
ASSERT_EQ(0xCDU, devConfig.blockDescriptor.densityCode);
for(int i=5;i<26;i++) buff[i] = 0xFF; // fill the space
ASSERT_EQ(0, devConfig.modePage.selectDataComprAlgorithm );
ASSERT_EQ(0U, devConfig.modePage.selectDataComprAlgorithm );
buff[26] |= 0xEF;
ASSERT_EQ(0xEF, devConfig.modePage.selectDataComprAlgorithm);
ASSERT_EQ(0xEFU, devConfig.modePage.selectDataComprAlgorithm);
}
TEST(SCSI_Structures, tapeAlertLogPage_t_and_parameters) {
......@@ -448,30 +448,30 @@ namespace UnitTests {
/* Check the size of the structure (header is 4 bytes, array elements, 5.*/
/* As usual, this ensures we have POD */
ASSERT_EQ(4 + 12*5, sizeof(tal));
ASSERT_EQ(4U + 12U*5U, sizeof(tal));
ASSERT_EQ(0, tal.pageCode);
ASSERT_EQ(0U, tal.pageCode);
buff[0] |= (0x12 & 0x3F) << 0;
ASSERT_EQ(0x12, tal.pageCode);
ASSERT_EQ(0x12U, tal.pageCode);
ASSERT_EQ(0,tal.subPageCode);
ASSERT_EQ(0U,tal.subPageCode);
buff[1] = 0x34;
ASSERT_EQ(0x34, tal.subPageCode);
ASSERT_EQ(0x34U, tal.subPageCode);
/* Simulate 123 records = 600 bytes = 0x267 */
ASSERT_EQ(0, SCSI::Structures::toU16(tal.pageLength));
ASSERT_EQ(0U, SCSI::Structures::toU16(tal.pageLength));
buff[2] = 0x2; buff[3]= 0x67;
ASSERT_EQ(0x267, SCSI::Structures::toU16(tal.pageLength));
ASSERT_EQ(0x267U, SCSI::Structures::toU16(tal.pageLength));
/* The page length is counted in bytes. We are interested in the number of parameters*/
ASSERT_EQ(123, tal.parameterNumber());
ASSERT_EQ(123U, tal.parameterNumber());
ASSERT_EQ(0, SCSI::Structures::toU16(tal.parameters[0].parameterCode));
ASSERT_EQ(0U, SCSI::Structures::toU16(tal.parameters[0].parameterCode));
buff [4] = 0xCA; buff[5] = 0xFE;
ASSERT_EQ(0xCAFE, SCSI::Structures::toU16(tal.parameters[0].parameterCode));
ASSERT_EQ(0xCAFEU, SCSI::Structures::toU16(tal.parameters[0].parameterCode));
ASSERT_EQ(0, tal.parameters[11].flag);
ASSERT_EQ(0U, tal.parameters[11].flag);
buff[3+12*5] |= (0x1) << 0;
ASSERT_EQ(1, tal.parameters[11].flag);
ASSERT_EQ(1U, tal.parameters[11].flag);
}
TEST(SCSI_Structures, senseBuffer_t) {
......@@ -480,9 +480,9 @@ namespace UnitTests {
/* Check the total size of the structure, plus the one of each of the members
of the union */
ASSERT_EQ(255, sizeof(sense));
ASSERT_EQ(255 - 1, sizeof(sense.descriptorFormat));
ASSERT_EQ(255 - 1, sizeof(sense.fixedFormat));
ASSERT_EQ(255U, sizeof(sense));
ASSERT_EQ(255U - 1U, sizeof(sense.descriptorFormat));
ASSERT_EQ(255U - 1U, sizeof(sense.fixedFormat));
buff[0] = 0x70;
buff[12] = 0x12;
......@@ -552,12 +552,12 @@ namespace UnitTests {
TEST(SCSI_Structures, toU32) {
unsigned char num[4] = { 0x1, 0x2, 0x3, 0x4 };
ASSERT_EQ( 0x1020304, SCSI::Structures::toU32(num));
ASSERT_EQ( 0x1020304U, SCSI::Structures::toU32(num));
}
TEST(SCSI_Structures, toU32_3byte) {
unsigned char num[3] = { 0xAA, 0xBB, 0xCC };
ASSERT_EQ( 0x00AABBCC, SCSI::Structures::toU32(num));
ASSERT_EQ( 0x00AABBCCU, SCSI::Structures::toU32(num));
}
TEST(SCSI_Structures, toS32) {
......@@ -567,7 +567,7 @@ namespace UnitTests {
TEST(SCSI_Structures, toU64) {
unsigned char num[8] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE, 0xFA, 0xDE };
ASSERT_EQ ( 0xDEADBEEFCAFEFADEULL, SCSI::Structures::toU64(num));
ASSERT_EQ ( 0xDEADBEEFCAFEFADEU, SCSI::Structures::toU64(num));
}
TEST(SCSI_Strucutres, Exception) {
......@@ -591,4 +591,4 @@ namespace UnitTests {
ASSERT_NE(std::string::npos, what.find("In exception validation: "));
}
}
};
}
......@@ -57,10 +57,10 @@ namespace System {
char * realpath(const char* name, char* resolved) { return ::realpath(name, resolved); }
int open(const char* file, int oflag) { return ::open(file, oflag); }
int ioctl(int fd, unsigned long int request, struct mtget * mt_status) {
::ioctl(fd, request, mt_status);
return ::ioctl(fd, request, mt_status);
}
int ioctl(int fd, unsigned long int request, sg_io_hdr_t * sgh) {
::ioctl(fd, request, sgh);
return ::ioctl(fd, request, sgh);
}
ssize_t read(int fd, void* buf, size_t nbytes) { return ::read(fd, buf, nbytes); }
ssize_t write(int fd, const void *buf, size_t nbytes) { return ::write(fd, buf, nbytes); }
......@@ -87,6 +87,7 @@ namespace System {
virtual int ioctl(int fd, unsigned long int request, struct mtget * mt_status) = 0;
virtual int close(int fd) = 0;
virtual int stat(const char * path, struct stat *buf) = 0;
virtual ~virtualWrapper() {};
};
/**
......@@ -124,7 +125,7 @@ namespace System {
struct ourDIR {
std::string path;
int nextIdx;
unsigned int nextIdx;
struct dirent dent;
std::string dent_name;
};
......
......@@ -43,5 +43,5 @@ namespace Tape {
regex_t m_re;
bool m_set;
}; /* class regex */
}; /* namespace Utils */
}; /* namespace Tape */
} /* namespace Utils */
} /* namespace Tape */
......@@ -38,10 +38,10 @@ TEST(Regex, BasicFunctionality) {
ret1 = re.exec("1abc");
ret2 = re.exec("xyz");
ASSERT_EQ(ret1.size(), 2);
ASSERT_EQ(ret1.size(), 2U);
ASSERT_EQ(ret1[0], "ab");
ASSERT_EQ(ret1[1], "b");
ASSERT_EQ(ret2.size(), 0);
ASSERT_EQ(ret2.size(), 0U);
}
TEST(Regex, OperationalTest) {
......@@ -51,14 +51,14 @@ TEST(Regex, OperationalTest) {
ret2 = re.exec("scsi_tape:st124");
ret3 = re.exec("scsi_tape:st1a");
ASSERT_EQ(ret1.size(), 2);
ASSERT_EQ(ret1.size(), 2U);
ASSERT_EQ(ret1[0], "scsi_tape:st1");
ASSERT_EQ(ret1[1], "st1");
ASSERT_EQ(ret2.size(), 2);
ASSERT_EQ(ret2.size(), 2U);
ASSERT_EQ(ret2[0], "scsi_tape:st124");
ASSERT_EQ(ret2[1], "st124");
ASSERT_EQ(ret3.size(), 0);
ASSERT_EQ(ret3.size(), 0U);
}
};
}
......@@ -30,7 +30,7 @@ namespace UnitTests {
* and not supported. */
TEST(Architecture, 64bits) {
size_t pointerSizeInBits = 8*sizeof(void *);
ASSERT_EQ(64, pointerSizeInBits);
ASSERT_EQ(64U, pointerSizeInBits);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment