Add simple property test example

This commit is contained in:
Tyler Neely 2023-04-14 14:54:56 +00:00
parent e2e5a6032c
commit aff9c47f04
2 changed files with 38 additions and 0 deletions

View File

@ -34,3 +34,4 @@ add_simulation_test(shard_rsm.cpp)
add_simulation_test(bulk_load.cpp)
add_simulation_test(random_workload.cpp)
add_simulation_test(request_router.cpp)
add_simulation_test(property_test_demo.cpp)

View File

@ -0,0 +1,37 @@
// Copyright 2023 Memgraph Ltd.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
// License, and you may not use this file except in compliance with the Business Source License.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
// This test serves as an example of a property-based model test.
// It generates a cluster configuration and a set of operations to
// apply against both the real system and a greatly simplified model.
#include <chrono>
#include <gtest/gtest.h>
#include <rapidcheck.h>
#include <rapidcheck/gtest.h>
#include <spdlog/cfg/env.h>
#include "generated_operations.hpp"
namespace memgraph::tests::simulation {
void my_code(NonEmptyOpVec input) { RC_ASSERT(input.ops.size() < 3); }
RC_GTEST_PROP(PropertyTestDemo, Demo1, (NonEmptyOpVec ops, uint64_t rng_seed)) {
spdlog::cfg::load_env_levels();
my_code(ops);
spdlog::trace("passed stats comparison - all good!");
}
} // namespace memgraph::tests::simulation