mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
Added README documentation for unit tests and fixed typos (#106)
* Fixed minor typos in readme * Created a README for general unit testing purposes and fixed typo in main.cpp of unittests.
This commit is contained in:
@@ -42,7 +42,7 @@ Use these instructions to build a clio executable from source. These instruction
|
|||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
./b2 -j$((`nproc`+1))
|
./b2 -j$((`nproc`+1))
|
||||||
# Add the following 'export' command
|
# Add the following 'export' command
|
||||||
# to your profile file (/~.profile):
|
# to your profile file (~/.profile):
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
export BOOST_ROOT=/home/my_user/boost_1_75_0
|
export BOOST_ROOT=/home/my_user/boost_1_75_0
|
||||||
source ~/.profile
|
source ~/.profile
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ where nodes can prove that a piece of data is present in a ledger by sending
|
|||||||
the path from root to leaf. Other nodes can verify this path and be certain
|
the path from root to leaf. Other nodes can verify this path and be certain
|
||||||
that the data does actually exist in the ledger in question.
|
that the data does actually exist in the ledger in question.
|
||||||
|
|
||||||
clio instead flattens the data model, so lookups are 0(1). This results in time
|
clio instead flattens the data model, so lookups are O(1). This results in time
|
||||||
and space savings. This is possible because clio does not participate in the peer
|
and space savings. This is possible because clio does not participate in the peer
|
||||||
to peer protocol, and thus does not need to verify any data. clio fully trusts the
|
to peer protocol, and thus does not need to verify any data. clio fully trusts the
|
||||||
rippled nodes that are being used as a data source.
|
rippled nodes that are being used as a data source.
|
||||||
|
|||||||
31
unittests/README.md
Normal file
31
unittests/README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Unit Testing
|
||||||
|
The correctness of new implementations can be verified via running unit tests. Below are the information on how to run unit tests.
|
||||||
|
## Requirements
|
||||||
|
### 1. Cassandra cluster
|
||||||
|
Have access to a **local (127.0.0.1)** Cassandra cluster, opened at port **9042**. Please ensure that the cluster is successfully running before running Unit Tests.
|
||||||
|
### 2. Postgres server
|
||||||
|
Have access to a **local (127.0.0.1)** Postgres server, opened at port **5432**. The server must also have a super user named **postgres** with password set to **postgres**. In addition, modify *postgresql.conf* with the following field values:
|
||||||
|
```
|
||||||
|
max_connections = 1000
|
||||||
|
shared_buffers = 1280MB
|
||||||
|
```
|
||||||
|
## Running
|
||||||
|
To run the unit tests, first build Clio as normal, then execute `./clio_tests` to run the unit tests.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
Below is a list of currently available unit tests. Please keep in mind that this list should be constantly updated with new unit tests as new features are added to the project.
|
||||||
|
|
||||||
|
- BackendTest.basic
|
||||||
|
- Backend.cache
|
||||||
|
- Backend.cacheBackground
|
||||||
|
- Backend.cacheIntegration
|
||||||
|
|
||||||
|
# Adding Unit Tests
|
||||||
|
To add unit tests, append a new test block in the unittests/main.cpp file with the following format:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
TEST(module_name, test_name)
|
||||||
|
{
|
||||||
|
// Test code goes here
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -1642,7 +1642,7 @@ TEST(Backend, cacheBackground)
|
|||||||
ASSERT_EQ(idx, allObjs.size());
|
ASSERT_EQ(idx, allObjs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Backend, CacheIntegration)
|
TEST(Backend, cacheIntegration)
|
||||||
{
|
{
|
||||||
boost::asio::io_context ioc;
|
boost::asio::io_context ioc;
|
||||||
std::optional<boost::asio::io_context::work> work;
|
std::optional<boost::asio::io_context::work> work;
|
||||||
|
|||||||
Reference in New Issue
Block a user