Improve string tests in FppTest - #5566
Conversation
Coverage report — base
|
| Module | Line | Δ | Function | Δ | Branch | Δ |
|---|---|---|---|---|---|---|
Svc/FpySequencer |
86.31 | -0.03 | 98.59 | +0.00 | 77.18 | +0.00 |
Svc/CmdDispatcher |
97.00 | +0.03 | 91.67 | +0.00 | 91.49 | -0.09 |
Os/Generic |
89.25 | +0.13 | 88.16 | +0.00 | 73.27 | +0.00 |
Fw/DataStructures |
98.22 | +0.44 | 97.14 | +0.00 | 82.97 | +0.74 |
Os/Generic/Types |
92.50 | +0.71 | 92.86 | +0.00 | 76.64 | +1.87 |
Modules without UTs
CFDP/Checksum/GTest, Drv/LinuxGpioDriver, Drv/LinuxI2cDriver, Drv/LinuxSpiDriver, Drv/LinuxUartDriver, Drv/Ports/DataTypes, FppTestProject/FppTest/topology/async, FppTestProject/FppTest/topology/components/Comp, FppTestProject/FppTest/topology/components/Framework, FppTestProject/FppTest/topology/components/Receiver, FppTestProject/FppTest/topology/components/Sender, FppTestProject/FppTest/topology/guarded, FppTestProject/FppTest/topology/sync, FppTestProject/FppTest/topology/top_ports, FppTestProject/FppTest/topology/types, Fw/Com, Fw/Comp, Fw/FilePacket/GTest, Fw/Fpy, Fw/Obj, Fw/Port, Fw/Prm, Fw/Sm, Fw/Test, Fw/Types/GTest, Os/Models, Svc/Ccsds/Types, Svc/FatalHandler, Svc/Subtopologies/CdhCore, Svc/Subtopologies/ComCcsds, Svc/Subtopologies/ComCcsdsSdls, Svc/Subtopologies/ComFprime, Svc/Subtopologies/ComLoggerTee, Svc/Subtopologies/DataProducts, Svc/Subtopologies/DpCompression, Svc/Subtopologies/FileHandling, Svc/Subtopologies/FileHandlingCfdp, Svc/Subtopologies/FileHandlingCfdp/FileHandlingCfdpConfig, TestDeploymentsProject/Ref/DpDemo, TestDeploymentsProject/Ref/PingReceiver, TestDeploymentsProject/Ref/RecvBuffApp, TestDeploymentsProject/Ref/SendBuffApp, TestDeploymentsProject/Ref/Top, TestDeploymentsProject/Ref/TypeDemo, cmake/test/data/TestConfigDeployment, cmake/test/data/TestDeployment/TestBuildAutocoder, cmake/test/data/TestDeployment/TestHeaderAutocoder, cmake/test/data/TestDeployment/TestLinkDepends, cmake/test/data/TestDeployment/TestRelative, cmake/test/data/test-fprime-library/TestLibrary/TestComponent, cmake/test/data/test-fprime-library2/TestLibrary2/TestComponent
|
The preferred fix would be to get nasa/fpp#968 up to date and not rely on serializing to a string before sending to ostream |
… restore struct.fpp
|
|
||
| buf1 << s; | ||
| Fw::StringTemplate<1024> str; | ||
| s.toString(str); |
There was a problem hiding this comment.
This is better for testing s.toString, but now it doesn't test the << method of s at all. Can we keep both tests here (the truncated and non-truncated versions)?
There was a problem hiding this comment.
Updated the test to explicitly verify both the truncated operator<< behavior and the non-truncated toString() output using the larger buffer
There was a problem hiding this comment.
Looks good! Can you apply the same change to PrimitiveTest? The two cases (PrimitiveTest, NonPrimitiveTest) should operate in the same way.
There was a problem hiding this comment.
Done! I've updated PrimitiveTest to follow the exact same two-case testing pattern, verifying both the truncated operator<< output and the full toString() output.
Fixes #3703
#3703
Reason for Change
NonPrimitiveTest.ToStringunit test was failing due toFw::Stringbuffer capacity limits truncating the formatted struct output during assertion checks.-Werrorvariadic macro warnings onINSTANTIATE_TYPED_TEST_SUITE_PinPrimitiveTest.cppandmain.cpp.Description of Changes
NonPrimitiveTest.cppto useFw::StringTemplate<1024>buffer capacity to hold complete string representations without truncation duringtoString()assertions.NonPrimitiveTest.ToStringto match actual operator output.INSTANTIATE_TYPED_TEST_SUITE_Pinstantiations inPrimitiveTest.cppandmain.cppfor standard C++ variadic macro compliance under strict compiler flags.Build/Test Status
ninja FppTest_struct_ut_exe && ./bin/Darwin/FppTest_struct_ut_exe