From f260fa2774f645cd4849973824605571760cd2b2 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 17 Jun 2023 17:30:33 -0700 Subject: [PATCH] fix shared_array output limit off by one --- src/sharedarray.cpp | 2 +- test/testqgroup.cpp | 36 ++++++++++++++++++------------------ test/testtype.cpp | 4 ++-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/sharedarray.cpp b/src/sharedarray.cpp index e106ef1..fbe0dc0 100644 --- a/src/sharedarray.cpp +++ b/src/sharedarray.cpp @@ -114,7 +114,7 @@ void showArr(std::ostream& strm, const void* raw, size_t count, size_t limit) for(auto i : range(count)) { if(i!=0) strm<<", "; - if(i>limit) { + if(i>=limit) { strm<<"..."; break; } diff --git a/test/testqgroup.cpp b/test/testqgroup.cpp index 9875073..4e750d3 100644 --- a/test/testqgroup.cpp +++ b/test/testqgroup.cpp @@ -285,7 +285,7 @@ void testImage() " int32_t size = 100\n" " }\n" " ]\n" - " any value uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, 3276, ...]\n" + " any value uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n" " struct {\n" " struct \"alarm_t\" {\n" " int32_t severity = 0\n" @@ -333,7 +333,7 @@ void testImage() "dimension[1] struct\n" "dimension[1].size int32_t = 100\n" "value any\n" - "value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, 3276, ...]\n" + "value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n" "x.alarm.severity int32_t = 0\n" "x.alarm.status int32_t = 0\n" "x.alarm.message string = \"\"\n" @@ -379,7 +379,7 @@ void testImage() "dimension[1] struct\n" "dimension[1].size int32_t = 100\n" "value any\n" - "value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, 3276, ...]\n" + "value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n" "x.alarm.severity int32_t = 0\n" "x.alarm.status int32_t = 0\n" "x.alarm.message string = \"\"\n" @@ -425,7 +425,7 @@ void testImage() "dimension[1] struct\n" "dimension[1].size int32_t = 100\n" "value any\n" - "value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, 3276, ...]\n" + "value-> uint16_t[] = {10000}[0, 655, 1310, 1966, 2621, ...]\n" "x.alarm.severity int32_t = 0\n" "x.alarm.status int32_t = 0\n" "x.alarm.message string = \"\"\n" @@ -458,7 +458,7 @@ void testIQ() " } _options\n" " } record\n" " struct \"epics:nt/NTScalarArray:1.0\" {\n" - " double[] value = {500}[0.0174524, 0.0801989, 0.142629, 0.204496, 0.265556, 0.325568, ...]\n" + " double[] value = {500}[0.0174524, 0.0801989, 0.142629, 0.204496, 0.265556, ...]\n" " struct \"alarm_t\" {\n" " int32_t severity = 0\n" " int32_t status = 0\n" @@ -477,7 +477,7 @@ void testIQ() " int32_t precision = 0\n" " struct \"enum_t\" {\n" " int32_t index = 6\n" - " string[] choices = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", \"Exponential\", ...]\n" + " string[] choices = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", ...]\n" " } form\n" " } display\n" " struct {\n" @@ -499,7 +499,7 @@ void testIQ() " } valueAlarm\n" " } I\n" " struct \"epics:nt/NTScalarArray:1.0\" {\n" - " double[] value = {500}[0.0174524, 0.0801989, 0.142629, 0.204496, 0.265556, 0.325568, ...]\n" + " double[] value = {500}[0.0174524, 0.0801989, 0.142629, 0.204496, 0.265556, ...]\n" " struct \"alarm_t\" {\n" " int32_t severity = 0\n" " int32_t status = 0\n" @@ -518,7 +518,7 @@ void testIQ() " int32_t precision = 0\n" " struct \"enum_t\" {\n" " int32_t index = 6\n" - " string[] choices = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", \"Exponential\", ...]\n" + " string[] choices = {7}[\"Default\", \"String\", \"Binary\", \"Decimal\", \"Hex\", ...]\n" " } form\n" " } display\n" " struct {\n" @@ -547,7 +547,7 @@ void testIQ() ); testStrEq(std::string(SB()<