> On Jan. 3, 2019, 9:48 a.m., Benjamin Mahler wrote: > > Stale summary? > > > > Partial review since it looks like some of what's being tested will change > > based on updates to the first patch.
Ah, sorry, summary updated. > On Jan. 3, 2019, 9:48 a.m., Benjamin Mahler wrote: > > src/Makefile.am > > Lines 2541 (patched) > > <https://reviews.apache.org/r/69600/diff/2/?file=2116926#file2116926line2541> > > > > Seems we should name this file and the header `resource_quantities.hpp` > > and `resource_quantities_tests.cpp`? Done. > On Jan. 3, 2019, 9:48 a.m., Benjamin Mahler wrote: > > src/tests/quantities_tests.cpp > > Lines 27 (patched) > > <https://reviews.apache.org/r/69600/diff/2/?file=2116928#file2116928line27> > > > > Seems odd to have a namespace for this, just having > > mesos::internal::ResourceQuantities live one level beneath mesos::Resources > > seems more appropriate? > > > > Also, I think we try to avoid `using` entire namespaces going forward. Done. > On Jan. 3, 2019, 9:48 a.m., Benjamin Mahler wrote: > > src/tests/quantities_tests.cpp > > Lines 158 (patched) > > <https://reviews.apache.org/r/69600/diff/2/?file=2116928#file2116928line158> > > > > Hm.. holding a vector iterator while insertions might happen seems > > error prone and we'd like to avoid tests crashing when they fail. > > > > Is there a safer way to check what you want to check? E.g. just call > > `begin()` or `get("cpus")` each time. Done. > On Jan. 3, 2019, 9:48 a.m., Benjamin Mahler wrote: > > src/tests/quantities_tests.cpp > > Lines 162-163 (patched) > > <https://reviews.apache.org/r/69600/diff/2/?file=2116928#file2116928line162> > > > > Maybe this can be more readable with a scalar producing lambda? > > > > ``` > > auto scalar = [](double d) { ... }; > > > > quantities.subtract("cpus", scalar(4)); > > ``` > > > > Also, is it possible to check the storage more succinctly and readably? > > > > ``` > > EXPECT_EQ({{"cpus", 6.0}}, toVector(quantities)); > > ``` > > > > toVector would produce a `vector<pair<string,Value::Scalar>>` via the > > iterators. Yeah, that would be much readable. But we do not have an implicit constructor for value::scalar from numbers. - Meng ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/69600/#review211639 ----------------------------------------------------------- On Jan. 4, 2019, 12:14 p.m., Meng Zhu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/69600/ > ----------------------------------------------------------- > > (Updated Jan. 4, 2019, 12:14 p.m.) > > > Review request for mesos and Benjamin Mahler. > > > Repository: mesos > > > Description > ------- > > Added parsing and insertion tests for `ResourceQuantities`. > > > Diffs > ----- > > src/Makefile.am 7a4904a3d67479267087fd2313a263d8218843fa > src/tests/CMakeLists.txt c588183e9d2b1cc733fdf3df70f37d47a5fdd7c0 > src/tests/resource_quantities_tests.cpp PRE-CREATION > > > Diff: https://reviews.apache.org/r/69600/diff/3/ > > > Testing > ------- > > make check > > > Thanks, > > Meng Zhu > >
