MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_featurebits_or

Function test_featurebits_or

common/test/run-features.c:105–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105static void test_featurebits_or(void)
106{
107 u8 *f1 = tal_arr(tmpctx, u8, 0);
108 u8 *f2 = tal_arr(tmpctx, u8, 0);
109 u8 *control = tal_arr(tmpctx, u8, 0);
110 for (size_t i = 0; i < 100; i += 3) {
111 set_feature_bit(&f1, i);
112 set_feature_bit(&control, i);
113 }
114
115 for (size_t i = 0; i < 10; i += 2) {
116 set_feature_bit(&f2, i);
117 set_feature_bit(&control, i);
118 }
119 u8 *result = featurebits_or(tmpctx, take(f1), f2);
120 assert(
121 memeq(result, tal_bytelen(result), control, tal_bytelen(control)));
122}
123
124static bool feature_set_eq(const struct feature_set *f1,
125 const struct feature_set *f2)

Callers 1

mainFunction · 0.85

Calls 4

set_feature_bitFunction · 0.85
memeqFunction · 0.85
tal_bytelenFunction · 0.85
featurebits_orFunction · 0.50

Tested by

no test coverage detected