> On Feb. 5, 2016, 2:33 a.m., Guangya Liu wrote: > > src/tests/resources_tests.cpp, lines 327-328 > > <https://reviews.apache.org/r/42751/diff/4/?file=1235800#file1235800line327> > > > > Just a question, do we have some guidelines for when to use `ASSERT_EQ` > > and when to use `EXPECT_EQ` ?
We use `ASSERT_*` in cases where the violation of such condition invalidates the rest of the test. For example, in this case, if `cpus->type()` is not a `Value::SCALAR`, then we violate `cpus->scalar()`'s preconditions and therefore is invalid. We use `EXPECT_*` if the condition is one that we want to test and, if even it fails, it doesn't mean the rest of the test is non-sensical. Take for example: ``` std::vector<int> x = f(0, 1, 2); // `ASSERT_*` here since if we have less than 3 elements, `x[2]` is invalid. ASSERT_GE(x.size(), 3); // Each of these are independent test cases. // For example, even if x[0] != 0, it doesn't invalidate the rest of our tests. EXPECT_EQ(0, x[0]); EXPECT_EQ(1, x[1]); EXPECT_EQ(2, x[2]); ``` - Michael ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/42751/#review117946 ----------------------------------------------------------- On Feb. 5, 2016, 2:19 a.m., Neil Conway wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/42751/ > ----------------------------------------------------------- > > (Updated Feb. 5, 2016, 2:19 a.m.) > > > Review request for mesos and Michael Park. > > > Repository: mesos > > > Description > ------- > > We should check that two reservations with the same role but different > principals are considered distinct. > > > Diffs > ----- > > src/tests/resources_tests.cpp 4b25e82c13e4f46c73803f773db90f269c09c48a > > Diff: https://reviews.apache.org/r/42751/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Neil Conway > >
