gecko-dev/mfbt/tests
Nicholas Nethercote b3d842431f Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj.
This patch implements mozilla::NotNull, which is similar but not identicial to
gsl::not_null.

The current draft(?) implementation of gsl::not_null is at
https://github.com/Microsoft/GSL/blob/master/include/gsl.h.

The main difference is that not_null allows implicit conversion from T to
not_null<T>. In contrast, NotNull only allows explicit conversion from T to
NotNull<T> via WrapNotNull().

The rationale for this is that when converting from a less-constrained type to
a more constrained type, implicit conversion is undesirable. For example, if I
changed a function f from this:

  f(int* aPtr);

to this:

  f(gsl::not_null<int*> aPtr);

no call sites would have to be modified. But if I changed it to this:

  f(mozilla::NotNull<int*> aPtr);

call sites *would* need to be modified. This is a good thing! It forces the
author to audit the call sites for non-nullness, and encourages them to
back-propagate NotNull throughout the code.

The other difference between not_null and NotNull is that not_null disables
pointer arithmetic, which means it cannot be used with array pointers. I have
not implemented this restriction for NotNull because it seems arbitrary and
unnecessary.
2016-05-12 14:21:16 +10:00
..
TestArrayUtils.cpp
TestAtomics.cpp Bug 1220693 - Make mozilla::Atomic<enum class> work even on compilers that don't have <atomic>. r=froydnj 2015-11-03 13:03:26 -08:00
TestBinarySearch.cpp Bug 1231224 part 10 - Make various Vector calls check for OOM. r=terrence 2016-01-06 21:06:25 +01:00
TestBloomFilter.cpp
TestBufferList.cpp Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) 2016-05-27 09:57:40 -07:00
TestCasting.cpp
TestCeilingFloor.cpp
TestCheckedInt.cpp
TestCountPopulation.cpp
TestCountZeroes.cpp
TestEndian.cpp Bug 1275016 - Rename Endian.h to EndianUtils.h to avoid #include confusion with Android's endian.h stdlib header. r=froydnj 2016-05-22 13:31:11 -07:00
TestEnumSet.cpp Bug 1266404 - Allow construction of an EnumSet<T> using an initializer list r=Waldo 2016-04-28 14:25:05 +01:00
TestFastBernoulliTrial.cpp Bug 1206357: Add mfbt/FastBernoulliTrial.h, implementing efficient random sampling. r=waldo 2015-10-08 13:05:31 -07:00
TestFloatingPoint.cpp
TestFunction.cpp Bug 1253678 - Rename mozilla::Function to mozilla::function. r=froydnj 2016-03-11 16:49:13 -05:00
TestInitializerList.cpp Bug 1228641. Add a polyfill of std::initializer_list. r=froydnj 2016-01-06 22:06:35 -05:00
TestIntegerPrintfMacros.cpp
TestIntegerRange.cpp
TestJSONWriter.cpp
TestLinkedList.cpp Bug 1212624 - Tests for LinkedList, r=Waldo 2015-10-07 12:36:00 -07:00
TestMacroArgs.cpp
TestMacroForEach.cpp
TestMathAlgorithms.cpp
TestMaybe.cpp Bug 1266294 - Remove unnecessary compiler version checks for gcc <= 4.8.0 in mfbt. r=froydnj 2016-04-17 17:08:10 -07:00
TestNotNull.cpp Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. 2016-05-12 14:21:16 +10:00
TestPair.cpp
TestPoisonArea.cpp Bug 1232765 - Remove the workaround added in bug 1022050 2016-02-07 14:50:50 -05:00
TestRefPtr.cpp Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
TestRollingMean.cpp
TestSHA1.cpp
TestSaturate.cpp Bug 1194721: Add |Saturate| template for saturation arithmetics, r=nfroyd 2016-02-04 12:35:12 +01:00
TestScopeExit.cpp
TestSegmentedVector.cpp Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
TestSplayTree.cpp Bug 1219392 - Capitalize mozilla::unused to avoid conflicts. r=froydnj 2015-11-02 07:53:26 +02:00
TestTemplateLib.cpp
TestTuple.cpp Bug 1221368 - Change MakeTuple to decay the types of its arguments (r=froydnj) 2015-11-09 10:21:11 -08:00
TestTypeTraits.cpp Bug 1241901 part 3 - Add IsMemberPointer and IsScalar type traits. r=froydnj 2016-01-30 10:33:41 +11:00
TestTypedEnum.cpp
TestUniquePtr.cpp Bug 1255857 - Allow mozilla::UniquePtr's deleter template argument to customize the pointer type; r=froydnj 2016-03-11 15:35:43 -05:00
TestVariant.cpp Backed out changeset e673dbc9848f (bug 1232686) for breaking VS2013 Builds 2016-04-16 10:57:53 +02:00
TestVector.cpp Bug 1259021 - Add Vector::extractRawBuffer method that doesn't copy the buffer r=Waldo 2016-04-25 13:41:25 +01:00
TestWeakPtr.cpp
TestXorShift128PlusRNG.cpp
moz.build Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. 2016-05-12 14:21:16 +10:00