obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
49 lines
881 B
C++
49 lines
881 B
C++
#include <gtest/gtest.h>
|
|
#include <vanetza/common/bit_number.hpp>
|
|
#include <cstdint>
|
|
|
|
using namespace vanetza;
|
|
|
|
TEST(BitNumber, ctor) {
|
|
BitNumber<uint32_t, 20> a;
|
|
EXPECT_EQ(a.raw(), 0);
|
|
|
|
BitNumber<uint32_t, 20> b(0x0fffff);
|
|
EXPECT_EQ(b.raw(), 0x0fffff);
|
|
}
|
|
|
|
TEST(BitNumber, mask) {
|
|
BitNumber<uint32_t, 20> a(0xf01234);
|
|
EXPECT_EQ(a.raw(), 0x1234);
|
|
|
|
BitNumber<uint32_t, 1> b(4);
|
|
EXPECT_EQ(b.raw(), 0);
|
|
b = 1;
|
|
EXPECT_EQ(b.raw(), 1);
|
|
}
|
|
|
|
TEST(BitNumber, equality) {
|
|
BitNumber<int8_t, 3> a;
|
|
BitNumber<int8_t, 3> b(0);
|
|
EXPECT_EQ(a, b);
|
|
|
|
a = 3;
|
|
EXPECT_NE(a, b);
|
|
}
|
|
|
|
TEST(BitNumber, less) {
|
|
BitNumber<uint16_t, 4> a(3);
|
|
BitNumber<uint16_t, 4> b(4);
|
|
EXPECT_LT(a, b);
|
|
EXPECT_LE(a, b);
|
|
EXPECT_GT(b, a);
|
|
|
|
a = 4;
|
|
EXPECT_LE(a, b);
|
|
EXPECT_GE(a, b);
|
|
|
|
b = 17; // 17 is masked to 1
|
|
EXPECT_LE(b, a);
|
|
}
|
|
|