Skip to content

Commit 4a5cc57

Browse files
authored
Merge pull request #545 from EricJMarti/master
[C++] Cleaning up unit tests' global namespaces
2 parents 1c7ff3d + 803e7f2 commit 4a5cc57

8 files changed

+29
-39
lines changed

sbe-tool/src/test/cpp/BoundsCheckTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
2121
#include "code_generation_test/MessageHeader.h"
2222
#include "code_generation_test/Car.h"
2323

24-
using namespace std;
2524
using namespace code::generation::test;
2625

2726
#define SERIAL_NUMBER 1234u

sbe-tool/src/test/cpp/CodeGenTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
#include "code_generation_test/MessageHeader.h"
2020
#include "code_generation_test/Car.h"
2121

22-
using namespace std;
2322
using namespace code::generation::test;
2423

2524
static const std::size_t BUFFER_LEN = 2048;

sbe-tool/src/test/cpp/CompositeElementsTest.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,9 +22,7 @@
2222
#include "otf/OtfHeaderDecoder.h"
2323
#include "otf/OtfMessageDecoder.h"
2424

25-
using namespace std;
2625
using namespace composite::elements;
27-
using namespace sbe::otf;
2826

2927
enum EventNumber
3028
{

sbe-tool/src/test/cpp/CompositeOffsetsCodeGenTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
#include "composite_offsets_test/MessageHeader.h"
2020
#include "composite_offsets_test/TestMessage1.h"
2121

22-
using namespace std;
2322
using namespace composite::offsets::test;
2423

2524
class CompositeOffsetsCodeGenTest : public testing::Test

sbe-tool/src/test/cpp/CompositeOffsetsIrTest.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,9 +22,7 @@
2222
#include "otf/OtfMessageDecoder.h"
2323
#include "otf/IrDecoder.h"
2424

25-
using namespace std;
2625
using namespace composite::offsets::test;
27-
using namespace sbe::otf;
2826

2927
static const char *SCHEMA_FILENAME = "composite-offsets-schema.sbeir";
3028

@@ -165,4 +163,4 @@ TEST_F(CompositeOffsetsIrTest, shouldHandleAllEventsCorrectltInOrder)
165163
EXPECT_EQ(result, static_cast<std::size_t>(52 - MessageHeader::encodedLength()));
166164

167165
EXPECT_EQ(m_eventNumber, 5);
168-
}
166+
}

sbe-tool/src/test/cpp/GroupWithDataTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
2121
#include "group_with_data/TestMessage3.h"
2222
#include "group_with_data/TestMessage4.h"
2323

24-
using namespace std;
24+
// using namespace std;
2525
using namespace group::with::data;
2626

2727
static const std::uint32_t TAG_1 = 32;

sbe-tool/src/test/cpp/MessageBlockLengthTest.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,9 +22,7 @@
2222
#include "otf/OtfHeaderDecoder.h"
2323
#include "otf/OtfMessageDecoder.h"
2424

25-
using namespace std;
2625
using namespace message::block::length::test;
27-
using namespace sbe::otf;
2826

2927
class MessageBlockLengthIrTest : public testing::Test, public OtfMessageDecoder::BasicTokenListener
3028
{
@@ -191,4 +189,4 @@ TEST_F(MessageBlockLengthIrTest, shouldHandleAllEventsCorrectltInOrder)
191189
EXPECT_EQ(result, static_cast<std::size_t>(54 - MessageHeader::encodedLength()));
192190

193191
EXPECT_EQ(m_eventNumber, 7);
194-
}
192+
}

sbe-tool/src/test/cpp/Rc3OtfFullIrTest.cpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2017 Real Logic Ltd.
2+
* Copyright 2013-2018 Real Logic Ltd.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323
#include "otf/OtfHeaderDecoder.h"
2424
#include "otf/OtfMessageDecoder.h"
2525

26-
using namespace std;
2726
using namespace code::generation::test;
2827

2928
static const char *SCHEMA_FILENAME = "code-generation-schema.sbeir";
@@ -283,7 +282,7 @@ class Rc3OtfFullIrTest : public testing::Test
283282

284283
void onBeginMessage(Token& token)
285284
{
286-
cout << m_eventNumber << ": Begin Message " << token.name() << " id " << token.fieldId() << "\n";
285+
std::cout << m_eventNumber << ": Begin Message " << token.name() << " id " << token.fieldId() << "\n";
287286

288287
EXPECT_EQ(EventNumber(m_eventNumber), EN_beginMessage);
289288
EXPECT_EQ(token.fieldId(), Car::sbeTemplateId());
@@ -292,7 +291,7 @@ class Rc3OtfFullIrTest : public testing::Test
292291

293292
void onEndMessage(Token& token)
294293
{
295-
cout << m_eventNumber << ": End Message " << token.name() << "\n";
294+
std::cout << m_eventNumber << ": End Message " << token.name() << "\n";
296295

297296
EXPECT_EQ(EventNumber(m_eventNumber), EN_endMessage);
298297
EXPECT_EQ(token.fieldId(), Car::sbeTemplateId());
@@ -306,7 +305,7 @@ class Rc3OtfFullIrTest : public testing::Test
306305
std::uint64_t actingVersion)
307306
{
308307
std::string name = (m_compositeLevel > 1) ? typeToken.name() : fieldToken.name();
309-
cout << m_eventNumber << ": Encoding " << name << " offset " << typeToken.offset() << "\n";
308+
std::cout << m_eventNumber << ": Encoding " << name << " offset " << typeToken.offset() << "\n";
310309

311310
const Encoding& encoding = typeToken.encoding();
312311

@@ -543,7 +542,7 @@ class Rc3OtfFullIrTest : public testing::Test
543542
std::size_t toIndex,
544543
std::uint64_t actingVersion)
545544
{
546-
cout << m_eventNumber << ": Enum " << determineName(fieldToken, tokens, fromIndex) << "\n";
545+
std::cout << m_eventNumber << ": Enum " << determineName(fieldToken, tokens, fromIndex) << "\n";
547546

548547
const Token& typeToken = tokens.at(fromIndex + 1);
549548
const Encoding& encoding = typeToken.encoding();
@@ -564,7 +563,7 @@ class Rc3OtfFullIrTest : public testing::Test
564563
const Token& token = tokens.at(i);
565564
const std::uint64_t constValue = token.encoding().constValue().getAsUInt();
566565

567-
cout << " " << token.name() << " = " << constValue << "\n";
566+
std::cout << " " << token.name() << " = " << constValue << "\n";
568567

569568
if (constValue == value)
570569
{
@@ -589,7 +588,7 @@ class Rc3OtfFullIrTest : public testing::Test
589588
const Token& token = tokens.at(i);
590589
const std::int64_t constValue = token.encoding().constValue().getAsUInt();
591590

592-
cout << " " << token.name() << " = " << constValue << "\n";
591+
std::cout << " " << token.name() << " = " << constValue << "\n";
593592

594593
if (constValue == value)
595594
{
@@ -617,7 +616,7 @@ class Rc3OtfFullIrTest : public testing::Test
617616
const Token& token = tokens.at(i);
618617
const std::int64_t constValue = token.encoding().constValue().getAsInt();
619618

620-
cout << " " << token.name() << " = " << constValue << "\n";
619+
std::cout << " " << token.name() << " = " << constValue << "\n";
621620

622621
if (constValue == value.getAsInt())
623622
{
@@ -641,7 +640,7 @@ class Rc3OtfFullIrTest : public testing::Test
641640
const Token& token = tokens.at(i);
642641
const std::int64_t constValue = token.encoding().constValue().getAsUInt();
643642

644-
cout << " " << token.name() << " = " << constValue << "\n";
643+
std::cout << " " << token.name() << " = " << constValue << "\n";
645644

646645
if (constValue == value)
647646
{
@@ -667,7 +666,7 @@ class Rc3OtfFullIrTest : public testing::Test
667666
std::size_t toIndex,
668667
std::uint64_t actingVersion)
669668
{
670-
cout << m_eventNumber << ": Bit Set " << fieldToken.name() << "\n";
669+
std::cout << m_eventNumber << ": Bit Set " << fieldToken.name() << "\n";
671670

672671
const Token& typeToken = tokens.at(fromIndex + 1);
673672
const Encoding& encoding = typeToken.encoding();
@@ -690,15 +689,15 @@ class Rc3OtfFullIrTest : public testing::Test
690689

691690
if (constValue && value)
692691
{
693-
cout << " * ";
692+
std::cout << " * ";
694693
bitsSet++;
695694
}
696695
else
697696
{
698-
cout << " ";
697+
std::cout << " ";
699698
}
700699

701-
cout << token.name() << " = " << constValue << "\n";
700+
std::cout << token.name() << " = " << constValue << "\n";
702701
}
703702
EXPECT_EQ(bitsSet, 2);
704703
break;
@@ -719,7 +718,7 @@ class Rc3OtfFullIrTest : public testing::Test
719718
m_compositeLevel++;
720719
std::string name = determineName(fieldToken, tokens, fromIndex);
721720

722-
cout << m_eventNumber << ": Begin Composite " << name << "\n";
721+
std::cout << m_eventNumber << ": Begin Composite " << name << "\n";
723722

724723
switch (EventNumber(m_eventNumber))
725724
{
@@ -749,7 +748,7 @@ class Rc3OtfFullIrTest : public testing::Test
749748
std::string name = determineName(fieldToken, tokens, fromIndex);
750749
m_compositeLevel--;
751750

752-
cout << m_eventNumber << ": End Composite " << name << "\n";
751+
std::cout << m_eventNumber << ": End Composite " << name << "\n";
753752

754753
switch (EventNumber(m_eventNumber))
755754
{
@@ -774,7 +773,7 @@ class Rc3OtfFullIrTest : public testing::Test
774773
Token& token,
775774
std::uint64_t numInGroup)
776775
{
777-
cout << m_eventNumber << ": Group Header " << token.name() << " num " << numInGroup << "\n";
776+
std::cout << m_eventNumber << ": Group Header " << token.name() << " num " << numInGroup << "\n";
778777

779778
switch (EventNumber(m_eventNumber))
780779
{
@@ -815,7 +814,7 @@ class Rc3OtfFullIrTest : public testing::Test
815814
std::uint64_t groupIndex,
816815
std::uint64_t numInGroup)
817816
{
818-
cout << m_eventNumber << ": Begin Group " << token.name() << " " << groupIndex + 1 << "/" << numInGroup << "\n";
817+
std::cout << m_eventNumber << ": Begin Group " << token.name() << " " << groupIndex + 1 << "/" << numInGroup << "\n";
819818

820819
switch (EventNumber(m_eventNumber))
821820
{
@@ -908,7 +907,7 @@ class Rc3OtfFullIrTest : public testing::Test
908907
std::uint64_t groupIndex,
909908
std::uint64_t numInGroup)
910909
{
911-
cout << m_eventNumber << ": End Group " << token.name() << " " << groupIndex + 1 << "/" << numInGroup << "\n";
910+
std::cout << m_eventNumber << ": End Group " << token.name() << " " << groupIndex + 1 << "/" << numInGroup << "\n";
912911

913912
switch (EventNumber(m_eventNumber))
914913
{
@@ -1002,7 +1001,7 @@ class Rc3OtfFullIrTest : public testing::Test
10021001
std::uint64_t length,
10031002
Token& typeToken)
10041003
{
1005-
cout << m_eventNumber << ": Data " << fieldToken.name() << "\n";
1004+
std::cout << m_eventNumber << ": Data " << fieldToken.name() << "\n";
10061005

10071006
switch (EventNumber(m_eventNumber))
10081007
{

0 commit comments

Comments
 (0)