Skip to content

Commit

Permalink
Fix potentially flaky integration component test case (#848)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashton Larkin <[email protected]>
  • Loading branch information
adlarkin authored Jun 15, 2021
1 parent ee895b8 commit 5a3b1b8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/integration/components.cc
Original file line number Diff line number Diff line change
Expand Up @@ -882,31 +882,33 @@ TEST_F(ComponentsTest, LogicalAudioSourcePlayInfo)
TEST_F(ComponentsTest, LogicalMicrophone)
{
logical_audio::Microphone mic1;
mic1.id = 0;
mic1.id = 4;
mic1.volumeDetectionThreshold = 0.5;

logical_audio::Microphone mic2;
mic2.id = 1;
mic2.volumeDetectionThreshold = mic1.volumeDetectionThreshold;
mic2.id = 8;
mic2.volumeDetectionThreshold = 0.8;

// create components
auto comp1 = components::LogicalMicrophone(mic1);
auto comp2 = components::LogicalMicrophone(mic2);

// equality operators
EXPECT_NE(mic1, mic2);
EXPECT_FALSE(mic1 == mic2);
EXPECT_TRUE(mic1 != mic2);
EXPECT_NE(comp1, comp2);
EXPECT_FALSE(comp1 == comp2);
EXPECT_TRUE(comp1 != comp2);

// stream operators
std::ostringstream ostr;
comp1.Serialize(ostr);
EXPECT_EQ("0 0.5", ostr.str());
EXPECT_EQ("4 0.5", ostr.str());

std::istringstream istr;
std::istringstream istr(ostr.str());
components::LogicalMicrophone comp3;
comp3.Deserialize(istr);
EXPECT_EQ(comp1, comp3);
EXPECT_DOUBLE_EQ(comp1.Data().volumeDetectionThreshold,
comp3.Data().volumeDetectionThreshold);
}

/////////////////////////////////////////////////
Expand Down

0 comments on commit 5a3b1b8

Please sign in to comment.