Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

test(cpp): braces around EXPECT in if for gcc -Wdangling-else

Adeshina Lasisi9410966f1fd6
diff --git a/laya-cpp/tests/schema_test.cpp b/laya-cpp/tests/schema_test.cpp
index b6a5e6d0..00de4c4b 100644
--- a/laya-cpp/tests/schema_test.cpp
+++ b/laya-cpp/tests/schema_test.cpp
@@ -28,7 +28,9 @@ void CheckQuestion(const sc::Question& q, const Value& rec, const std::string& w
EXPECT_EQ(q.instructions(), rec.Find("instructions")->as_string()) << what;
EXPECT_EQ(q.RenderedOptions(), Strings(*rec.Find("options"))) << what;
EXPECT_EQ(q.Labels(), Strings(*rec.Find("labels"))) << what;
- if (const Value* lg = rec.Find("legend"); lg != nullptr && !lg->is_null()) EXPECT_EQ(q.Legend(), Strings(*lg)) << what;
+ if (const Value* lg = rec.Find("legend"); lg != nullptr && !lg->is_null()) {
+ EXPECT_EQ(q.Legend(), Strings(*lg)) << what;
+ }
std::vector<int> want;
if (const Value* o = rec.Find("option_order"); o != nullptr && !o->is_null()) {
for (const Value& v : o->items()) want.push_back(int(v.as_int()));
diff --git a/laya-cpp/tests/sequence_test.cpp b/laya-cpp/tests/sequence_test.cpp
index 0a6afab5..8922e814 100644
--- a/laya-cpp/tests/sequence_test.cpp
+++ b/laya-cpp/tests/sequence_test.cpp
@@ -108,7 +108,9 @@ TEST_P(SequenceRow, MatchesBuildSequence) {
EXPECT_EQ(seq.value().stats.options_distinct, stats.Find("options_distinct")->as_int()) << label;
const Value* tpo = stats.Find("tokens_per_option");
EXPECT_EQ(seq.value().stats.tokens_per_option.has_value(), !tpo->is_null()) << label;
- if (!tpo->is_null() && seq.value().stats.tokens_per_option) EXPECT_EQ(*seq.value().stats.tokens_per_option, tpo->as_int()) << label;
+ if (!tpo->is_null() && seq.value().stats.tokens_per_option) {
+ EXPECT_EQ(*seq.value().stats.tokens_per_option, tpo->as_int()) << label;
+ }
const Value& tr = *rec.Find("truncation");
sq::Truncation want{tr.Find("state_tokens")->as_int(), tr.Find("state_tokens_used")->as_int(),
tr.Find("state_tokens_dropped")->as_int(), tr.Find("truncated")->as_bool()};
@@ -288,7 +290,9 @@ TEST(BatchCap, MatchesPythonGrid) {
const Value* want = rec.Find("cap");
sq::Cap got = sq::BatchCap(n, w, cfg, batch);
EXPECT_EQ(got.ok, !want->is_null()) << "row " << i;
- if (!want->is_null()) EXPECT_EQ(got.cap, want->as_int()) << "row " << i;
+ if (!want->is_null()) {
+ EXPECT_EQ(got.cap, want->as_int()) << "row " << i;
+ }
if (!want->is_null() && batch <= 0) capped++;
}
EXPECT_GT(capped, 0);