Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit f8490f77 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add test with exotic C types

parent 1c3d359d
......@@ -11,4 +11,5 @@ include(callGenerator.cmake)
cmake_minimum_required(VERSION 2.8)
call_generator(test_type_t_lib configType.ph5)
add_executable(test_type_t main.cpp)
target_link_libraries(test_type_t test_type_t_lib ${HDF5_CXX_LIBRARIES})
add_test(NAME TestTypeT
///Table of types
///Float value
float valFloat;
///Double value
float valDouble;
///In value
int32_t valInt;
///Short value
int16_t valShort;
///Char value
int8_t valChar;
///unsigned int value
uint32_t valUInt;
Auteur : Pierre Aubert
Mail :
Licence : CeCILL-C
#include "configType.h"
///Test to write data
/** @param fileName : name of the file to be written
* @return true on success, false otherwise
bool testWriteData(const std::string & fileName){
TableType table;
size_t nbRow(10lu);
//Let's set some values in the Table
for(size_t i(0lu); i < nbRow; ++i){
table.setValFloat(i, i);
table.setValDouble(i, 2lu*i);
table.setValInt(i, 3lu*i);
table.setValShort(i, 4lu*i);
table.setValUInt(i, 5lu*i);
table.setValChar(i, i);
//Now let's open a file
H5::H5File file(fileName, H5F_ACC_TRUNC);
//And write our table directly in it
//We can also explicitly cloase the file, otherwise it will do it automatically
return true;
///Test to read data
/** @param fileName : name of the file to be read
* @return true on success, false otherwise
bool testReadData(const std::string & fileName){
//First let's open a file in read only mode (better for concurencial access)
H5::H5File file(fileName, H5F_ACC_RDONLY);
//Let's create our table
TableType table;
//Add read the file;
//Now we can close the file and use the Table directly
//Get the number of rows and number of columns
size_t nbRow = table.getNbRow();
bool b(true);
for(size_t i(0lu); i < nbRow; ++i){
b &= table.getValFloat(i) == i;
b &= table.getValDouble(i) == 2lu*i;
b &= table.getValInt(i) == (int)(3lu*i);
b &= table.getValShort(i) == (short)(4lu*i);
b &= table.getValUInt(i) == 5lu*i;
b &= table.getValChar(i) == (char)i;
return b;
int main(int argc, char** argv){
std::string fileName("configType.h5");
std::cerr << "Cannot write file '"<<fileName<<"'" << std::endl;
return -1;
std::cerr << "Cannot read file '"<<fileName<<"'" << std::endl;
return -1;
return 0;
Markdown is supported
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