Commit 45669152 authored by Tommaso Tocci's avatar Tommaso Tocci Committed by Marc Vef
Browse files

Test file size in simple wr test

parent a7a1ba64
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <cstring>
#include <sys/stat.h>

using namespace std;

@@ -53,6 +54,20 @@ int main(int argc, char* argv[]) {
        return -1;
    }

    /* Check file size */
    struct stat st;

    ret = stat(p.c_str(), &st);
    if(ret != 0){
        cerr << "Error stating file: " << strerror(errno) << endl;
        return -1;
    };

    if(st.st_size != strlen(buffIn)){
        cerr << "Wrong file size after creation: " << st.st_size << endl;
        return -1;
    }


    /* Read the file back */