41
tests/test_libs/test_libs.cpp
Normal file
41
tests/test_libs/test_libs.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <fmt/format.h>
|
||||
#include <sqlite3.h>
|
||||
#include <ctime>
|
||||
|
||||
int main() {
|
||||
// Test fmt
|
||||
std::string formatted = fmt::format("Testing fmt: {} + {} = {}", 1, 2, 3);
|
||||
std::cout << formatted << std::endl;
|
||||
|
||||
// Test spdlog
|
||||
spdlog::info("Testing spdlog: Hello from spdlog!");
|
||||
spdlog::warn("This is a warning message");
|
||||
|
||||
// Test sqlite3
|
||||
sqlite3* db;
|
||||
int rc = sqlite3_open(":memory:", &db);
|
||||
if (rc == SQLITE_OK) {
|
||||
spdlog::info("SQLite3 opened successfully, version: {}", sqlite3_libversion());
|
||||
sqlite3_close(db);
|
||||
} else {
|
||||
spdlog::error("Failed to open SQLite3");
|
||||
}
|
||||
|
||||
// Test pthread
|
||||
std::thread t([]() {
|
||||
spdlog::info("Hello from thread!");
|
||||
});
|
||||
t.join();
|
||||
|
||||
// Test rt (real-time) - using clock_gettime
|
||||
struct timespec ts;
|
||||
if (clock_gettime(CLOCK_REALTIME, &ts) == 0) {
|
||||
spdlog::info("Real-time clock: {}.{} seconds", ts.tv_sec, ts.tv_nsec);
|
||||
}
|
||||
|
||||
spdlog::info("All libraries linked successfully!");
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user