From bc85a0098dd1f0824f536bf5bd51a210df23ca4a Mon Sep 17 00:00:00 2001 From: "Tim.Ebbeke" Date: Fri, 15 Sep 2023 11:11:36 +0200 Subject: [PATCH] Made initializations explicit in tests. --- nui/test/nui/test_ranges.hpp | 54 ++++++++++++++++++------------------ nui/test/nui/test_render.hpp | 40 +++++++++++++------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/nui/test/nui/test_ranges.hpp b/nui/test/nui/test_ranges.hpp index e97de55..f84f6f2 100644 --- a/nui/test/nui/test_ranges.hpp +++ b/nui/test/nui/test_ranges.hpp @@ -52,7 +52,7 @@ namespace Nui::Tests TEST_F(TestRanges, SubscriptOperatorAssignmentUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -65,7 +65,7 @@ namespace Nui::Tests TEST_F(TestRanges, FullAssignmentUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -78,7 +78,7 @@ namespace Nui::Tests TEST_F(TestRanges, PushBackUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -96,7 +96,7 @@ namespace Nui::Tests TEST_F(TestRanges, PopBackUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -109,7 +109,7 @@ namespace Nui::Tests TEST_F(TestRanges, InsertUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; std::vector vec2 = {'1', '2', '3'}; rangeTextBodyRender(vec, parent); @@ -189,7 +189,7 @@ namespace Nui::Tests TEST_F(TestRanges, ClearUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -202,7 +202,7 @@ namespace Nui::Tests TEST_F(TestRanges, SwapUpdatesView) { Nui::val parent; - Observed> vec1 = {{'A', 'B', 'C', 'D'}}; + Observed> vec1{{'A', 'B', 'C', 'D'}}; std::vector vec2 = {'X', 'Y', 'Z'}; rangeTextBodyRender(vec1, parent); @@ -216,7 +216,7 @@ namespace Nui::Tests TEST_F(TestRanges, ResizeUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -229,7 +229,7 @@ namespace Nui::Tests TEST_F(TestRanges, ResizeWithFillValueUpdatesView) { Nui::val parent; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -242,7 +242,7 @@ namespace Nui::Tests TEST_F(TestRanges, AssignWithFillValueUpdatesView) { Nui::val parent; - Observed> vec1 = {{'A', 'B', 'C', 'D'}}; + Observed> vec1{{'A', 'B', 'C', 'D'}}; std::vector vec2 = {'X', 'Y', 'Z'}; rangeTextBodyRender(vec1, parent); @@ -264,7 +264,7 @@ namespace Nui::Tests TEST_F(TestRanges, AssignWithRangeUpdatesView) { Nui::val parent; - Observed> vec1 = {{'A', 'B', 'C', 'D'}}; + Observed> vec1{{'A', 'B', 'C', 'D'}}; std::vector vec2 = {'X', 'Y', 'Z'}; rangeTextBodyRender(vec1, parent); @@ -278,7 +278,7 @@ namespace Nui::Tests TEST_F(TestRanges, AssignWithInitializerListUpdatesView) { Nui::val parent; - Observed> vec1 = {{'A', 'B', 'C', 'D'}}; + Observed> vec1{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(vec1, parent); textBodyParityTest(vec1, parent); @@ -291,7 +291,7 @@ namespace Nui::Tests TEST_F(TestRanges, EmplaceBackUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -304,7 +304,7 @@ namespace Nui::Tests TEST_F(TestRanges, EmplaceUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -317,7 +317,7 @@ namespace Nui::Tests TEST_F(TestRanges, ModificationThroughPointerUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -330,7 +330,7 @@ namespace Nui::Tests TEST_F(TestRanges, ModificationThroughReferenceUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -343,7 +343,7 @@ namespace Nui::Tests TEST_F(TestRanges, ModificationThroughIteratorUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -356,7 +356,7 @@ namespace Nui::Tests TEST_F(TestRanges, ChangeOfReferenceFromBackUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -369,7 +369,7 @@ namespace Nui::Tests TEST_F(TestRanges, ChangeOfReferenceFromAtUpdatesView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -382,7 +382,7 @@ namespace Nui::Tests TEST_F(TestRanges, ChangeOfIteratorFromEndUpdateView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; rangeTextBodyRender(vec, parent); textBodyParityTest(vec, parent); @@ -395,7 +395,7 @@ namespace Nui::Tests TEST_F(TestRanges, ChangeOfIteratorFromRbeginUpdateView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; auto rbegin = vec.rbegin(); rangeTextBodyRender(vec, parent); @@ -409,7 +409,7 @@ namespace Nui::Tests TEST_F(TestRanges, ChangeOfIteratorFromRendUpdateView) { Nui::val parent; - Observed> vec = {{"A", "B", "C", "D"}}; + Observed> vec{{"A", "B", "C", "D"}}; auto rend = vec.rend(); rangeTextBodyRender(vec, parent); @@ -423,7 +423,7 @@ namespace Nui::Tests TEST_F(TestRanges, PushFrontUpdatesView) { Nui::val parent; - Observed> container = {{'A', 'B', 'C', 'D'}}; + Observed> container{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(container, parent); textBodyParityTest(container, parent); @@ -441,7 +441,7 @@ namespace Nui::Tests TEST_F(TestRanges, PopFrontUpdatesView) { Nui::val parent; - Observed> container = {{'A', 'B', 'C', 'D'}}; + Observed> container{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(container, parent); textBodyParityTest(container, parent); @@ -454,7 +454,7 @@ namespace Nui::Tests TEST_F(TestRanges, AggregatedInsertsUpdateCorrectly) { Nui::val parent; - Observed> container = {{'A', 'B', 'C', 'D'}}; + Observed> container{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(container, parent); textBodyParityTest(container, parent); @@ -468,7 +468,7 @@ namespace Nui::Tests TEST_F(TestRanges, AggregatedInsertsUpdateCorrectly2) { Nui::val parent; - Observed> container = {{'A', 'B', 'C', 'D'}}; + Observed> container{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(container, parent); textBodyParityTest(container, parent); @@ -483,7 +483,7 @@ namespace Nui::Tests TEST_F(TestRanges, MixOfInsertionAndErasureUpdateCorrectly) { Nui::val parent; - Observed> container = {{'A', 'B', 'C', 'D'}}; + Observed> container{{'A', 'B', 'C', 'D'}}; rangeTextBodyRender(container, parent); textBodyParityTest(container, parent); diff --git a/nui/test/nui/test_render.hpp b/nui/test/nui/test_render.hpp index ff261e4..8cd9953 100644 --- a/nui/test/nui/test_render.hpp +++ b/nui/test/nui/test_render.hpp @@ -78,7 +78,7 @@ namespace Nui::Tests using namespace Nui::Attributes; Nui::val elem; - Observed textContent = "Hello World"; + Observed textContent{"Hello World"}; render(div{}(span{reference = elem}(textContent))); @@ -95,7 +95,7 @@ namespace Nui::Tests using namespace Nui::Attributes; Nui::val elem; - Observed textContent = 13; + Observed textContent{13}; render(div{}(span{reference = elem}(textContent))); @@ -112,7 +112,7 @@ namespace Nui::Tests using namespace Nui::Attributes; Nui::val elem; - Observed textContent = 13.5; + Observed textContent{13.5}; render(div{}(span{reference = elem}(textContent))); @@ -156,7 +156,7 @@ namespace Nui::Tests using namespace Nui::Attributes; Nui::val nested; - Observed toggle = true; + Observed toggle{true}; render(body{}(observe(toggle), [&toggle, &nested]() { if (*toggle) @@ -183,8 +183,8 @@ namespace Nui::Tests using namespace Nui::Attributes; Nui::val nested; - Observed toggle = true; - Observed text = "Hello"; + Observed toggle{true}; + Observed text{"Hello"}; render(body{}(observe(toggle, text), [&toggle, &nested, &text]() -> ElementRenderer { if (*toggle) @@ -215,7 +215,7 @@ namespace Nui::Tests using Nui::Elements::body; using namespace Nui::Attributes; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; render(body{}(range(vec), [&vec](long long i, auto const& element) { return div{}(std::string{element} + ":" + std::to_string(i)); @@ -237,7 +237,7 @@ namespace Nui::Tests using Nui::Elements::body; using namespace Nui::Attributes; - Observed> vec = {{'A', 'B', 'C', 'D'}}; + Observed> vec{{'A', 'B', 'C', 'D'}}; auto verifyParity = [&vec]() { EXPECT_EQ( @@ -311,7 +311,7 @@ namespace Nui::Tests using Nui::Elements::button; using namespace Nui::Attributes; - Nui::Observed toggle = true; + Nui::Observed toggle{true}; StableElement stable; // clang-format off @@ -366,9 +366,9 @@ namespace Nui::Tests using Nui::Elements::span; using namespace Nui::Attributes; - Nui::Observed toggle = true; + Nui::Observed toggle{true}; StableElement stable; - Nui::Observed spanId = "dynamic"; + Nui::Observed spanId{"dynamic"}; // clang-format off render(div{}( @@ -417,7 +417,7 @@ namespace Nui::Tests using Nui::Elements::fragment; using namespace Nui::Attributes; - Nui::Observed toggle = true; + Nui::Observed toggle{true}; StableElement stable; // clang-format off @@ -451,7 +451,7 @@ namespace Nui::Tests using Nui::nil; using namespace Nui::Attributes; - Nui::Observed toggle = true; + Nui::Observed toggle{true}; StableElement stable; // Does not make much sense, but is not causing any issues: @@ -469,7 +469,7 @@ namespace Nui::Tests using Nui::Elements::button; using namespace Nui::Attributes; - Nui::Observed toggle = true; + Nui::Observed toggle{true}; StableElement stable; std::string once = "once"; @@ -554,7 +554,7 @@ namespace Nui::Tests { using namespace Nui::Elements; - Nui::Observed textContent = "Hello World"; + Nui::Observed textContent{"Hello World"}; render(div{}(text{textContent}())); @@ -571,7 +571,7 @@ namespace Nui::Tests { using namespace Nui::Elements; - Nui::Observed textContent = "Hello World"; + Nui::Observed textContent{"Hello World"}; render(div{}(text{textContent}())); @@ -599,7 +599,7 @@ namespace Nui::Tests { using namespace Nui::Elements; - Nui::Observed textContent = "Hello World"; + Nui::Observed textContent{"Hello World"}; render(div{}(span{}(), text{textContent}(), div{}())); @@ -618,7 +618,7 @@ namespace Nui::Tests { using namespace Nui::Elements; - Nui::Observed textContent = "Hello World"; + Nui::Observed textContent{"Hello World"}; StableElement stable; render(div{}(span{}(), stabilize(stable, text{textContent}()), div{}())); @@ -648,7 +648,7 @@ namespace Nui::Tests { using namespace Nui::Elements; - Nui::Observed textContent = "Hello World"; + Nui::Observed textContent{"Hello World"}; render(div{}(fragment(text{textContent}()))); @@ -665,7 +665,7 @@ namespace Nui::Tests { using namespace Nui::Elements; - Nui::Observed textContent = "Hello World"; + Nui::Observed textContent{"Hello World"}; render(div{}(fragment(span{}(), text{textContent}(), div{}())));