Use GTest; resolves #34 (#90)

This commit is contained in:
liuzicheng1987
2024-04-22 23:12:35 +02:00
committed by GitHub
parent bf1c9bea36
commit 325d163196
682 changed files with 1123 additions and 4799 deletions
+7 -10
View File
@@ -1,9 +1,6 @@
#include "test_unique_ptr2.hpp"
#include <cassert>
#include <iostream>
#include <rfl.hpp>
#include <rfl/flexbuf.hpp>
#include <source_location>
#include <string>
#include <vector>
@@ -14,13 +11,15 @@ namespace test_unique_ptr2 {
struct DecisionTree {
struct Leaf {
rfl::Field<"value", double> value;
using Tag = rfl::Literal<"Leaf">;
double value;
};
struct Node {
rfl::Field<"criticalValue", double> critical_value;
rfl::Field<"left", std::unique_ptr<DecisionTree>> lesser;
rfl::Field<"right", std::unique_ptr<DecisionTree>> greater;
using Tag = rfl::Literal<"Node">;
rfl::Rename<"criticalValue", double> critical_value;
std::unique_ptr<DecisionTree> lesser;
std::unique_ptr<DecisionTree> greater;
};
using LeafOrNode = rfl::TaggedUnion<"type", Leaf, Node>;
@@ -28,9 +27,7 @@ struct DecisionTree {
rfl::Field<"leafOrNode", LeafOrNode> leaf_or_node;
};
void test() {
std::cout << std::source_location::current().function_name() << std::endl;
TEST(flexbuf, test_unique_ptr2) {
auto leaf1 = DecisionTree::Leaf{.value = 3.0};
auto leaf2 = DecisionTree::Leaf{.value = 5.0};