Commit 062b41c3 authored by jan.koester's avatar jan.koester
Browse files

tes

parent 7976a633
Loading
Loading
Loading
Loading
Loading
+9 −5
Changes for tests/test_authdata.cpp: 9 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
 * memory-leak-free destruction.
 */
#include <gtest/gtest.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <uuidp.h>
#include <sstream>
@@ -70,19 +70,23 @@ TEST(AuthData, AppendCreatesLinkedList) {
    AuthData::Record r1;
    r1.type = UserData;
    r1.storage = TextStorage;
    strcpy_s(r1.fieldname, sizeof(r1.fieldname), "field1");
    std::copy("field1", "field1" + 6, r1.fieldname);
    r1.fieldname[5] = '\0';  // Ensure null termination
    r1.datasize = 5;
    r1.data = new char[5];
    strcpy_s(r1.data, 5, "val1");
    std::copy("val1", "val1" + 5, r1.data);
    r1.data[4] = '\0';  // Ensure null termination
    dat.append(r1);

    AuthData::Record r2;
    r2.type = GroupData;
    r2.storage = BinaryStorage;
    strcpy_s(r2.fieldname, sizeof(r2.fieldname), "field2");
    std::copy("field2", "field2" + 6, r2.fieldname);
    r2.fieldname[5] = '\0';  // Ensure null termination
    r2.datasize = 5;
    r2.data = new char[5];
    strcpy_s(r2.data, 5, "val2");
    std::copy("val2", "val2" + 5, r2.data);
    r2.data[4] = '\0';  // Ensure null termination
    dat.append(r2);

    // First append fills the root node (dat); second creates dat->_next