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 Bug 1120062 - Part 1: Remove most Nullptr.h includes. r=waldo 2015-01-11 11:34:52 +09:00
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 Bug 867348 - Part 2: Apply MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT to CheckedInt's constructor; r=jrmuizel,cpearce 2014-12-18 15:27:05 -05:00
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 Bug 1119980 - Use 'snprintf' instead of 'sprintf' to avoid a warning on Lollipop-based builds. r=froydnj 2015-05-26 14:33:55 -04:00
TestIntegerRange.cpp Bug 1175485 part 4 - Add unit test for integer range. r=waldo 2015-07-02 13:31:07 +10:00
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 Bug 1193600 - Add Clamp and IsPowerOfTwo to MFBT. - r=waldo 2015-09-04 13:33:10 -07:00
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 Bug 1143077 (Followup) - Add assignments to Pair test. 2015-03-17 19:40:17 -07:00
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 Bug 1180299 - Implement ScopeExit for running actions at the end of a scope, r=Waldo 2015-07-03 14:20:55 -07:00
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 Bug 1163328 - Add an And<...> class to TemplateLib.h which performs logical and on a variadic number of booleans known at compile time. r=froydnj 2015-05-21 22:33:39 -04:00
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 Bug 1111290 - Part 3: Remove TypedEnum.h and fold TypedEnumInternal.h into TypedEnumBits.h. r=waldo 2015-01-26 07:22:11 +09:00
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 Bug 1062479 - Use static strings for WeakReference type names. r=ehsan 2015-04-24 09:43:01 -07:00
TestXorShift128PlusRNG.cpp Bug 1206356: Add mfbt/Random.h, implementing the xorshift128+ random number generator. r=waldo 2015-09-23 13:59:28 -07:00
moz.build Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. 2016-05-12 14:21:16 +10:00