2026-02-28 01:56:55 +01:00
|
|
|
//
|
|
|
|
|
// Created by david on 28.02.2026.
|
|
|
|
|
//
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
#include "library.h"
|
2026-03-01 23:47:54 +01:00
|
|
|
#include "npy.hpp"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <filesystem>
|
2026-02-28 01:56:55 +01:00
|
|
|
|
|
|
|
|
// Demonstrate some basic assertions.
|
|
|
|
|
TEST(HelloTest, BasicAssertions) {
|
|
|
|
|
// Expect two strings not to be equal.
|
|
|
|
|
EXPECT_STRNE("hello", "world from test1.cpp");
|
|
|
|
|
// Expect equality.
|
|
|
|
|
EXPECT_EQ(7 * 6, 42);
|
|
|
|
|
printf("asdf");
|
|
|
|
|
hello();
|
2026-03-01 23:47:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(HelloTest, Load_npy_matrix) {
|
|
|
|
|
// "C:\\Users\\david\\Documents\\src\\libpasada\\cmake-build-debug\\google-tests"
|
|
|
|
|
std::cout << std::filesystem::current_path() << std::endl;
|
|
|
|
|
const std::string path {"test1/data1.npy"};
|
|
|
|
|
npy::npy_data d = npy::read_npy<double>(path);
|
|
|
|
|
std::vector<double> data = d.data;
|
|
|
|
|
std::vector<unsigned long> shape = d.shape;
|
|
|
|
|
bool fortran_order = d.fortran_order;
|
|
|
|
|
|
|
|
|
|
std::vector<unsigned long> expect_shape {2, 2};
|
|
|
|
|
std::vector<double> expect_data {1.0, 2.0, 3.0, 4.0};
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(shape, expect_shape);
|
|
|
|
|
EXPECT_EQ(fortran_order, false);
|
|
|
|
|
EXPECT_DOUBLE_EQ(data[0], expect_data[0]);
|
|
|
|
|
EXPECT_DOUBLE_EQ(data[1], expect_data[1]);
|
|
|
|
|
EXPECT_DOUBLE_EQ(data[2], expect_data[2]);
|
|
|
|
|
EXPECT_DOUBLE_EQ(data[3], expect_data[3]);
|
|
|
|
|
}
|