test/*: normalize allocation checks

(ASSERT|EXPECT)_TRUE(ptr != NULL) -> (ASSERT|EXPECT)_NE(ptr, nullptr)

Bug: aomedia:3276
Change-Id: Ia04f9bce2b3ec4ddd288478d76b51f313937cfc3
diff --git a/test/av1_encoder_parms_get_to_decoder.cc b/test/av1_encoder_parms_get_to_decoder.cc
index 66adbbe..e81ad87 100644
--- a/test/av1_encoder_parms_get_to_decoder.cc
+++ b/test/av1_encoder_parms_get_to_decoder.cc
@@ -150,7 +150,7 @@
 
   std::unique_ptr<libaom_test::VideoSource> video(
       new libaom_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames));
-  ASSERT_TRUE(video.get() != NULL);
+  ASSERT_NE(video, nullptr);
 
   ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
 }
diff --git a/test/decode_perf_test.cc b/test/decode_perf_test.cc
index 9f0de03..7c52cf2 100644
--- a/test/decode_perf_test.cc
+++ b/test/decode_perf_test.cc
@@ -135,7 +135,7 @@
     const std::string data_path(env ? env : ".");
     const std::string path_to_source = data_path + "/" + kNewEncodeOutputFile;
     outfile_ = fopen(path_to_source.c_str(), "wb");
-    ASSERT_TRUE(outfile_ != NULL);
+    ASSERT_NE(outfile_, nullptr);
   }
 
   virtual void EndPassHook() {
diff --git a/test/decode_test_driver.cc b/test/decode_test_driver.cc
index 70de0cf..246fc82 100644
--- a/test/decode_test_driver.cc
+++ b/test/decode_test_driver.cc
@@ -56,7 +56,7 @@
 void DecoderTest::RunLoop(CompressedVideoSource *video,
                           const aom_codec_dec_cfg_t &dec_cfg) {
   Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_);
-  ASSERT_TRUE(decoder != NULL);
+  ASSERT_NE(decoder, nullptr);
   bool end_of_file = false;
   bool peeked_stream = false;
 
diff --git a/test/encode_test_driver.cc b/test/encode_test_driver.cc
index 484437c..96714f4 100644
--- a/test/encode_test_driver.cc
+++ b/test/encode_test_driver.cc
@@ -189,7 +189,7 @@
     BeginPassHook(pass);
     std::unique_ptr<Encoder> encoder(
         codec_->CreateEncoder(cfg_, init_flags_, &stats_));
-    ASSERT_TRUE(encoder.get() != NULL);
+    ASSERT_NE(encoder, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(video->Begin());
     encoder->InitEncoder(video);
diff --git a/test/encodetxb_test.cc b/test/encodetxb_test.cc
index ecb9f73..ee09ea6 100644
--- a/test/encodetxb_test.cc
+++ b/test/encodetxb_test.cc
@@ -47,10 +47,10 @@
   virtual void SetUp() {
     coeff_contexts_ref_ = reinterpret_cast<int8_t *>(
         aom_memalign(16, sizeof(*coeff_contexts_ref_) * MAX_TX_SQUARE));
-    ASSERT_TRUE(coeff_contexts_ref_ != NULL);
+    ASSERT_NE(coeff_contexts_ref_, nullptr);
     coeff_contexts_ = reinterpret_cast<int8_t *>(
         aom_memalign(16, sizeof(*coeff_contexts_) * MAX_TX_SQUARE));
-    ASSERT_TRUE(coeff_contexts_ != NULL);
+    ASSERT_NE(coeff_contexts_, nullptr);
   }
 
   virtual void TearDown() {
diff --git a/test/end_to_end_psnr_test.cc b/test/end_to_end_psnr_test.cc
index e12df17..e6ab0ff 100644
--- a/test/end_to_end_psnr_test.cc
+++ b/test/end_to_end_psnr_test.cc
@@ -159,7 +159,7 @@
           test_video_param_.filename, test_video_param_.fmt, kWidth, kHeight,
           kFramerate, 1, 0, kFrames));
     }
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr = GetAveragePsnr();
diff --git a/test/end_to_end_qmpsnr_test.cc b/test/end_to_end_qmpsnr_test.cc
index 84a5c78..de183ad 100644
--- a/test/end_to_end_qmpsnr_test.cc
+++ b/test/end_to_end_qmpsnr_test.cc
@@ -160,7 +160,7 @@
     std::unique_ptr<libaom_test::VideoSource> video(
         new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
                                         kFrames));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double ssim = GetAverageSsim();
     EXPECT_GT(ssim, GetSsimThreshold())
diff --git a/test/end_to_end_ssim_test.cc b/test/end_to_end_ssim_test.cc
index 1e638d7..2e40c94 100644
--- a/test/end_to_end_ssim_test.cc
+++ b/test/end_to_end_ssim_test.cc
@@ -156,7 +156,7 @@
     std::unique_ptr<libaom_test::VideoSource> video(
         new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
                                         kFrames));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double ssim = GetAverageSsim();
     EXPECT_GT(ssim, GetSsimThreshold())
diff --git a/test/external_frame_buffer_test.cc b/test/external_frame_buffer_test.cc
index 0b2d09a..84bf584 100644
--- a/test/external_frame_buffer_test.cc
+++ b/test/external_frame_buffer_test.cc
@@ -52,7 +52,7 @@
     num_buffers_ = num_buffers;
     ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
     if (ext_fb_list_ == nullptr) {
-      EXPECT_TRUE(ext_fb_list_ != NULL);
+      EXPECT_NE(ext_fb_list_, nullptr);
       return false;
     }
     memset(ext_fb_list_, 0, sizeof(ext_fb_list_[0]) * num_buffers_);
@@ -64,7 +64,7 @@
   // frame buffer is in use by libaom. Finally sets |fb| to point to the
   // external frame buffer. Returns < 0 on an error.
   int GetFreeFrameBuffer(size_t min_size, aom_codec_frame_buffer_t *fb) {
-    EXPECT_TRUE(fb != NULL);
+    EXPECT_NE(fb, nullptr);
     const int idx = FindFreeBufferIndex();
     if (idx == num_buffers_) return -1;
 
@@ -87,7 +87,7 @@
   // Test function that will not allocate any data for the frame buffer.
   // Returns < 0 on an error.
   int GetZeroFrameBuffer(size_t min_size, aom_codec_frame_buffer_t *fb) {
-    EXPECT_TRUE(fb != NULL);
+    EXPECT_NE(fb, nullptr);
     const int idx = FindFreeBufferIndex();
     if (idx == num_buffers_) return -1;
 
@@ -105,13 +105,13 @@
   // Returns < 0 on an error.
   int ReturnFrameBuffer(aom_codec_frame_buffer_t *fb) {
     if (fb == NULL) {
-      EXPECT_TRUE(fb != NULL);
+      EXPECT_NE(fb, nullptr);
       return -1;
     }
     ExternalFrameBuffer *const ext_fb =
         reinterpret_cast<ExternalFrameBuffer *>(fb->priv);
     if (ext_fb == NULL) {
-      EXPECT_TRUE(ext_fb != NULL);
+      EXPECT_NE(ext_fb, nullptr);
       return -1;
     }
     EXPECT_EQ(1, ext_fb->in_use);
@@ -147,7 +147,7 @@
   // Sets |fb| to an external frame buffer. idx is the index into the frame
   // buffer list.
   void SetFrameBuffer(int idx, aom_codec_frame_buffer_t *fb) {
-    ASSERT_TRUE(fb != NULL);
+    ASSERT_NE(fb, nullptr);
     fb->data = ext_fb_list_[idx].data;
     fb->size = ext_fb_list_[idx].size;
     ASSERT_EQ(0, ext_fb_list_[idx].in_use);
@@ -232,13 +232,13 @@
 
   void OpenMD5File(const std::string &md5_file_name_) {
     md5_file_ = libaom_test::OpenTestDataFile(md5_file_name_);
-    ASSERT_TRUE(md5_file_ != NULL)
+    ASSERT_NE(md5_file_, nullptr)
         << "Md5 file open failed. Filename: " << md5_file_name_;
   }
 
   virtual void DecompressedFrameHook(const aom_image_t &img,
                                      const unsigned int frame_number) {
-    ASSERT_TRUE(md5_file_ != NULL);
+    ASSERT_NE(md5_file_, nullptr);
     char expected_md5[33];
     char junk[128];
 
@@ -316,14 +316,14 @@
 
   virtual void SetUp() {
     video_ = new libaom_test::WebMVideoSource(kAV1TestFile);
-    ASSERT_TRUE(video_ != NULL);
+    ASSERT_NE(video_, nullptr);
     video_->Init();
     video_->Begin();
 
     aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t();
     cfg.allow_lowbitdepth = !FORCE_HIGHBITDEPTH_DECODING;
     decoder_ = new libaom_test::AV1Decoder(cfg, 0);
-    ASSERT_TRUE(decoder_ != NULL);
+    ASSERT_NE(decoder_, nullptr);
   }
 
   virtual void TearDown() {
@@ -384,14 +384,14 @@
  protected:
   virtual void SetUp() {
     video_ = new libaom_test::IVFVideoSource(kAV1NonRefTestFile);
-    ASSERT_TRUE(video_ != NULL);
+    ASSERT_NE(video_, nullptr);
     video_->Init();
     video_->Begin();
 
     aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t();
     cfg.allow_lowbitdepth = !FORCE_HIGHBITDEPTH_DECODING;
     decoder_ = new libaom_test::AV1Decoder(cfg, 0);
-    ASSERT_TRUE(decoder_ != NULL);
+    ASSERT_NE(decoder_, nullptr);
   }
 
   virtual void CheckFrameBufferRelease() {
@@ -430,7 +430,7 @@
     return;
 #endif
   }
-  ASSERT_TRUE(video.get() != NULL);
+  ASSERT_NE(video, nullptr);
   video->Init();
 
   // Construct md5 file name.
diff --git a/test/frame_error_test.cc b/test/frame_error_test.cc
index 7acda9f..c355efc 100644
--- a/test/frame_error_test.cc
+++ b/test/frame_error_test.cc
@@ -61,8 +61,8 @@
       static_cast<uint8_t *>(aom_memalign(16, max_blk_size * sizeof(*dst)));
   uint8_t *const ref =
       static_cast<uint8_t *>(aom_memalign(16, max_blk_size * sizeof(*ref)));
-  ASSERT_TRUE(dst != NULL);
-  ASSERT_TRUE(ref != NULL);
+  ASSERT_NE(dst, nullptr);
+  ASSERT_NE(ref, nullptr);
   for (int i = 0; i < max_blk_size; ++i) {
     dst[i] = rnd_.Rand8();
     ref[i] = rnd_.Rand8();
@@ -83,8 +83,8 @@
       static_cast<uint8_t *>(aom_memalign(16, max_blk_size * sizeof(*dst)));
   uint8_t *const ref =
       static_cast<uint8_t *>(aom_memalign(16, max_blk_size * sizeof(*ref)));
-  ASSERT_TRUE(dst != NULL);
-  ASSERT_TRUE(ref != NULL);
+  ASSERT_NE(dst, nullptr);
+  ASSERT_NE(ref, nullptr);
   for (int r = 0; r < 2; r++) {
     if (r == 0) {
       memset(dst, 0, max_blk_size);
@@ -111,8 +111,8 @@
       static_cast<uint8_t *>(aom_memalign(16, max_blk_size * sizeof(*dst)));
   uint8_t *const ref =
       static_cast<uint8_t *>(aom_memalign(16, max_blk_size * sizeof(*ref)));
-  ASSERT_TRUE(dst != NULL);
-  ASSERT_TRUE(ref != NULL);
+  ASSERT_NE(dst, nullptr);
+  ASSERT_NE(ref, nullptr);
   for (int i = 0; i < max_blk_size; ++i) {
     dst[i] = ref[i] = rnd_.Rand8();
   }
diff --git a/test/hash_test.cc b/test/hash_test.cc
index 17796cc..5ce0fbb 100644
--- a/test/hash_test.cc
+++ b/test/hash_test.cc
@@ -58,7 +58,7 @@
   bsize_ = GET_PARAM(1);
   length_ = bsize_ * bsize_ * sizeof(uint16_t);
   buffer_ = new uint8_t[length_];
-  ASSERT_TRUE(buffer_ != NULL);
+  ASSERT_NE(buffer_, nullptr);
   for (size_t i = 0; i < length_; ++i) {
     buffer_[i] = rnd_.Rand8();
   }
diff --git a/test/horz_superres_test.cc b/test/horz_superres_test.cc
index 0006b4e..12e14dc 100644
--- a/test/horz_superres_test.cc
+++ b/test/horz_superres_test.cc
@@ -158,7 +158,7 @@
     std::unique_ptr<libaom_test::VideoSource> video;
     video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
                                                 test_video_param_.limit));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr_thresh = (superres_mode_ == AOM_SUPERRES_AUTO)
@@ -263,7 +263,7 @@
     std::unique_ptr<libaom_test::VideoSource> video;
     video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
                                                 test_video_param_.limit));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr = GetAveragePsnr();
@@ -373,7 +373,7 @@
     std::unique_ptr<libaom_test::VideoSource> video;
     video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
                                                 test_video_param_.limit));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr = GetAveragePsnr();
diff --git a/test/invalid_file_test.cc b/test/invalid_file_test.cc
index acc8986..c84c8c9 100644
--- a/test/invalid_file_test.cc
+++ b/test/invalid_file_test.cc
@@ -51,7 +51,7 @@
 
   void OpenResFile(const std::string &res_file_name) {
     res_file_ = libaom_test::OpenTestDataFile(res_file_name);
-    ASSERT_TRUE(res_file_ != NULL)
+    ASSERT_NE(res_file_, nullptr)
         << "Result file open failed. Filename: " << res_file_name;
   }
 
@@ -64,7 +64,7 @@
       const aom_codec_err_t res_dec,
       const libaom_test::CompressedVideoSource &video,
       libaom_test::Decoder *decoder) {
-    EXPECT_TRUE(res_file_ != NULL);
+    EXPECT_NE(res_file_, nullptr);
     int expected_res_dec = -1;
 
     // Read integer result.
diff --git a/test/ivf_video_source.h b/test/ivf_video_source.h
index ff28414..f7efd67 100644
--- a/test/ivf_video_source.h
+++ b/test/ivf_video_source.h
@@ -45,14 +45,13 @@
   virtual void Init() {
     // Allocate a buffer for read in the compressed video frame.
     compressed_frame_buf_ = new uint8_t[kCodeBufferSize];
-    ASSERT_TRUE(compressed_frame_buf_ != NULL)
-        << "Allocate frame buffer failed";
+    ASSERT_NE(compressed_frame_buf_, nullptr) << "Allocate frame buffer failed";
     ASAN_POISON_MEMORY_REGION(compressed_frame_buf_, kCodeBufferSize);
   }
 
   virtual void Begin() {
     input_file_ = OpenTestDataFile(file_name_);
-    ASSERT_TRUE(input_file_ != NULL)
+    ASSERT_NE(input_file_, nullptr)
         << "Input file open failed. Filename: " << file_name_;
 
     // Read file header
@@ -73,7 +72,7 @@
   }
 
   void FillFrame() {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     uint8_t frame_hdr[kIvfFrameHdrSize];
     // Check frame header and read a frame from input_file.
     if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) !=
diff --git a/test/level_test.cc b/test/level_test.cc
index 2ee715b..a329828 100644
--- a/test/level_test.cc
+++ b/test/level_test.cc
@@ -104,7 +104,7 @@
 TEST_P(LevelTest, TestTargetLevel19) {
   std::unique_ptr<libaom_test::VideoSource> video;
   video.reset(new libaom_test::Y4mVideoSource("park_joy_90p_8_420.y4m", 0, 10));
-  ASSERT_TRUE(video.get() != NULL);
+  ASSERT_NE(video, nullptr);
   // Level index 19 corresponding to level 6.3.
   target_level_ = 19;
   ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
diff --git a/test/loopfilter_control_test.cc b/test/loopfilter_control_test.cc
index 2d0cc5a..5f01340 100644
--- a/test/loopfilter_control_test.cc
+++ b/test/loopfilter_control_test.cc
@@ -147,7 +147,7 @@
     std::unique_ptr<libaom_test::VideoSource> video;
     video.reset(new libaom_test::Y4mVideoSource(test_video_param_.filename, 0,
                                                 kFrames));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr = GetAveragePsnr();
diff --git a/test/metadata_test.cc b/test/metadata_test.cc
index 85803ed..7143294 100644
--- a/test/metadata_test.cc
+++ b/test/metadata_test.cc
@@ -288,7 +288,7 @@
   EXPECT_TRUE(aom_img_get_metadata(&image, 10u) == NULL);
 
   const aom_metadata_t *metadata = aom_img_get_metadata(&image, 0);
-  ASSERT_TRUE(metadata != NULL);
+  ASSERT_NE(metadata, nullptr);
   ASSERT_EQ(metadata->sz, kMetadataPayloadSizeT35);
   EXPECT_EQ(
       memcmp(kMetadataPayloadT35, metadata->payload, kMetadataPayloadSizeT35),
@@ -320,7 +320,7 @@
   ASSERT_EQ(number_metadata, 3u);
   for (size_t i = 0; i < number_metadata; ++i) {
     const aom_metadata_t *metadata = aom_img_get_metadata(&image, i);
-    ASSERT_TRUE(metadata != NULL);
+    ASSERT_NE(metadata, nullptr);
     ASSERT_EQ(metadata->type, types[i]);
     ASSERT_EQ(metadata->sz, kMetadataPayloadSizeT35);
     EXPECT_EQ(
diff --git a/test/motion_vector_test.cc b/test/motion_vector_test.cc
index f1f3ae03..bf10ede 100644
--- a/test/motion_vector_test.cc
+++ b/test/motion_vector_test.cc
@@ -92,7 +92,7 @@
   video.reset(new libaom_test::YUVVideoSource(
       "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, width, height, 30, 1, 0, 3));
 
-  ASSERT_TRUE(video.get() != NULL);
+  ASSERT_NE(video, nullptr);
   ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
 }
 
diff --git a/test/register_state_check.h b/test/register_state_check.h
index 4bf5120..3c244c2 100644
--- a/test/register_state_check.h
+++ b/test/register_state_check.h
@@ -51,7 +51,7 @@
  private:
   static bool StoreRegisters(CONTEXT *const context) {
     const HANDLE this_thread = GetCurrentThread();
-    EXPECT_TRUE(this_thread != NULL);
+    EXPECT_NE(this_thread, nullptr);
     context->ContextFlags = CONTEXT_FLOATING_POINT;
     const bool context_saved = GetThreadContext(this_thread, context) == TRUE;
     EXPECT_TRUE(context_saved) << "GetLastError: " << GetLastError();
diff --git a/test/rt_end_to_end_test.cc b/test/rt_end_to_end_test.cc
index dc12f2c..a6f39c1 100644
--- a/test/rt_end_to_end_test.cc
+++ b/test/rt_end_to_end_test.cc
@@ -166,7 +166,7 @@
       video.reset(new libaom_test::YUVVideoSource(test_video_param_.filename,
                                                   test_video_param_.fmt, 352,
                                                   288, 30, 1, 0, kFrames));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr = GetAveragePsnr();
diff --git a/test/sharpness_test.cc b/test/sharpness_test.cc
index 8fd31ff..49c5804 100644
--- a/test/sharpness_test.cc
+++ b/test/sharpness_test.cc
@@ -97,7 +97,7 @@
 
     std::unique_ptr<libaom_test::VideoSource> video(
         new libaom_test::Y4mVideoSource("paris_352_288_30.y4m", 0, kFrames));
-    ASSERT_TRUE(video.get() != NULL);
+    ASSERT_NE(video, nullptr);
 
     ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
     const double psnr = GetAveragePsnr();
diff --git a/test/sse_sum_test.cc b/test/sse_sum_test.cc
index ecb89e4..e7c32e6 100644
--- a/test/sse_sum_test.cc
+++ b/test/sse_sum_test.cc
@@ -46,7 +46,7 @@
     params_ = this->GetParam();
     rnd_.Reset(ACMRandom::DeterministicSeed());
     src_ = reinterpret_cast<int16_t *>(aom_memalign(16, 256 * 256 * 2));
-    ASSERT_TRUE(src_ != NULL);
+    ASSERT_NE(src_, nullptr);
   }
 
   virtual void TearDown() { aom_free(src_); }
diff --git a/test/sum_squares_test.cc b/test/sum_squares_test.cc
index 65fde3e..5c049a5 100644
--- a/test/sum_squares_test.cc
+++ b/test/sum_squares_test.cc
@@ -48,7 +48,7 @@
     params_ = this->GetParam();
     rnd_.Reset(ACMRandom::DeterministicSeed());
     src_ = reinterpret_cast<int16_t *>(aom_memalign(16, 256 * 256 * 2));
-    ASSERT_TRUE(src_ != NULL);
+    ASSERT_NE(src_, nullptr);
   }
 
   virtual void TearDown() { aom_free(src_); }
@@ -259,8 +259,8 @@
     rnd_.Reset(ACMRandom::DeterministicSeed());
     src_ = reinterpret_cast<uint8_t *>(aom_memalign(32, 256 * 256 * 2));
     ref_ = reinterpret_cast<uint8_t *>(aom_memalign(32, 256 * 256 * 2));
-    ASSERT_TRUE(src_ != NULL);
-    ASSERT_TRUE(ref_ != NULL);
+    ASSERT_NE(src_, nullptr);
+    ASSERT_NE(ref_, nullptr);
   }
 
   virtual void TearDown() {
@@ -445,7 +445,7 @@
     width_ = GET_PARAM(1);
     rnd_.Reset(ACMRandom::DeterministicSeed());
     src_ = reinterpret_cast<int16_t *>(aom_memalign(32, 256 * 256 * 2));
-    ASSERT_TRUE(src_ != NULL);
+    ASSERT_NE(src_, nullptr);
   }
 
   virtual void TearDown() { aom_free(src_); }
@@ -588,7 +588,7 @@
     rnd_.Reset(ACMRandom::DeterministicSeed());
     src_ = reinterpret_cast<uint8_t *>(
         aom_memalign(16, 512 * 512 * sizeof(uint8_t)));
-    ASSERT_TRUE(src_ != NULL);
+    ASSERT_NE(src_, nullptr);
   }
 
   virtual void TearDown() { aom_free(src_); }
@@ -716,7 +716,7 @@
     rnd_.Reset(ACMRandom::DeterministicSeed());
     src_ = reinterpret_cast<uint16_t *>(
         aom_memalign(16, 512 * 512 * sizeof(uint16_t)));
-    ASSERT_TRUE(src_ != NULL);
+    ASSERT_NE(src_, nullptr);
   }
 
   virtual void TearDown() { aom_free(src_); }
diff --git a/test/temporal_filter_test.cc b/test/temporal_filter_test.cc
index 7b51901..bf61f02 100644
--- a/test/temporal_filter_test.cc
+++ b/test/temporal_filter_test.cc
@@ -68,8 +68,8 @@
     src2_ = reinterpret_cast<uint8_t *>(
         aom_memalign(8, sizeof(uint8_t) * MAX_MB_PLANE * BH * BW));
 
-    ASSERT_TRUE(src1_ != NULL);
-    ASSERT_TRUE(src2_ != NULL);
+    ASSERT_NE(src1_, nullptr);
+    ASSERT_NE(src2_, nullptr);
   }
 
   virtual void TearDown() {
@@ -321,8 +321,8 @@
     src2_ = reinterpret_cast<uint16_t *>(
         aom_memalign(16, sizeof(uint16_t) * MAX_MB_PLANE * BH * BW));
 
-    ASSERT_TRUE(src1_ != NULL);
-    ASSERT_TRUE(src2_ != NULL);
+    ASSERT_NE(src1_, nullptr);
+    ASSERT_NE(src2_, nullptr);
   }
 
   virtual void TearDown() {
diff --git a/test/test_vector_test.cc b/test/test_vector_test.cc
index 5cfcb6f..9fa2c2c 100644
--- a/test/test_vector_test.cc
+++ b/test/test_vector_test.cc
@@ -47,7 +47,7 @@
 
   void OpenMD5File(const std::string &md5_file_name_) {
     md5_file_ = libaom_test::OpenTestDataFile(md5_file_name_);
-    ASSERT_TRUE(md5_file_ != NULL)
+    ASSERT_NE(md5_file_, nullptr)
         << "Md5 file open failed. Filename: " << md5_file_name_;
   }
 
@@ -59,7 +59,7 @@
 
   virtual void DecompressedFrameHook(const aom_image_t &img,
                                      const unsigned int frame_number) {
-    ASSERT_TRUE(md5_file_ != NULL);
+    ASSERT_NE(md5_file_, nullptr);
     char expected_md5[33];
     char junk[128];
 
@@ -131,7 +131,7 @@
     return;
 #endif
   }
-  ASSERT_TRUE(video.get() != NULL);
+  ASSERT_NE(video, nullptr);
   video->Init();
 
   // Construct md5 file name.
diff --git a/test/tpl_model_test.cc b/test/tpl_model_test.cc
index ed2f593..e41077f 100644
--- a/test/tpl_model_test.cc
+++ b/test/tpl_model_test.cc
@@ -10,6 +10,8 @@
  */
 
 #include <cstdlib>
+#include <memory>
+#include <new>
 #include <vector>
 
 #include "av1/encoder/cost.h"
@@ -75,8 +77,10 @@
 }
 
 TEST(TplModelTest, InitTplStats1) {
-  // We use "new" here to avoid -Wstack-usagea warning
-  TplParams *tpl_data = new TplParams;
+  // We use heap allocation instead of stack allocation here to avoid
+  // -Wstack-usage warning.
+  std::unique_ptr<TplParams> tpl_data(new (std::nothrow) TplParams);
+  ASSERT_NE(tpl_data, nullptr);
   av1_zero(*tpl_data);
   tpl_data->ready = 1;
   EXPECT_EQ(sizeof(tpl_data->tpl_stats_buffer),
@@ -85,12 +89,11 @@
     // Set it to a random non-zero number
     tpl_data->tpl_stats_buffer[i].is_valid = i + 1;
   }
-  av1_init_tpl_stats(tpl_data);
+  av1_init_tpl_stats(tpl_data.get());
   EXPECT_EQ(tpl_data->ready, 0);
   for (int i = 0; i < MAX_LENGTH_TPL_FRAME_STATS; ++i) {
     EXPECT_EQ(tpl_data->tpl_stats_buffer[i].is_valid, 0);
   }
-  delete tpl_data;
 }
 
 TEST(TplModelTest, DeltaRateCostZeroFlow) {
diff --git a/test/variance_test.cc b/test/variance_test.cc
index e4478d1..62d510d 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -427,8 +427,8 @@
         aom_memalign(16, block_size() * sizeof(src_)));
     dst_ = reinterpret_cast<uint8_t *>(
         aom_memalign(16, block_size() * sizeof(dst_)));
-    ASSERT_TRUE(src_ != NULL);
-    ASSERT_TRUE(dst_ != NULL);
+    ASSERT_NE(src_, nullptr);
+    ASSERT_NE(dst_, nullptr);
   }
 
   virtual void TearDown() {
@@ -526,8 +526,8 @@
         use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);
     src_ = reinterpret_cast<uint8_t *>(aom_memalign(16, block_size() * unit));
     ref_ = new uint8_t[block_size() * unit];
-    ASSERT_TRUE(src_ != NULL);
-    ASSERT_TRUE(ref_ != NULL);
+    ASSERT_NE(src_, nullptr);
+    ASSERT_NE(ref_, nullptr);
     memset(src_, 0, block_size() * sizeof(src_[0]));
     memset(ref_, 0, block_size() * sizeof(ref_[0]));
     if (use_high_bit_depth()) {
@@ -937,9 +937,9 @@
       ref_ = CONVERT_TO_BYTEPTR(aom_memalign(
           32, (block_size() + width() + height() + 1) * sizeof(uint16_t)));
     }
-    ASSERT_TRUE(src_ != NULL);
-    ASSERT_TRUE(sec_ != NULL);
-    ASSERT_TRUE(ref_ != NULL);
+    ASSERT_NE(src_, nullptr);
+    ASSERT_NE(sec_, nullptr);
+    ASSERT_NE(ref_, nullptr);
   }
 
   virtual void TearDown() {
@@ -1193,9 +1193,9 @@
         aom_memalign(32, block_size() * sizeof(uint32_t)));
     mask_ = reinterpret_cast<int32_t *>(
         aom_memalign(32, block_size() * sizeof(uint32_t)));
-    ASSERT_TRUE(pre_ != NULL);
-    ASSERT_TRUE(wsrc_ != NULL);
-    ASSERT_TRUE(mask_ != NULL);
+    ASSERT_NE(pre_, nullptr);
+    ASSERT_NE(wsrc_, nullptr);
+    ASSERT_NE(mask_, nullptr);
   }
 
   virtual void TearDown() {
@@ -1584,8 +1584,8 @@
         aom_memalign(16, block_size() * sizeof(src_)));
     dst_ = reinterpret_cast<uint16_t *>(
         aom_memalign(16, block_size() * sizeof(dst_)));
-    ASSERT_TRUE(src_ != NULL);
-    ASSERT_TRUE(dst_ != NULL);
+    ASSERT_NE(src_, nullptr);
+    ASSERT_NE(dst_, nullptr);
   }
 
   virtual void TearDown() {
diff --git a/test/webm_video_source.h b/test/webm_video_source.h
index 7b85e67..61c64cc 100644
--- a/test/webm_video_source.h
+++ b/test/webm_video_source.h
@@ -46,7 +46,7 @@
     ASSERT_NE(aom_ctx_, nullptr);
     ASSERT_NE(webm_ctx_, nullptr);
     aom_ctx_->file = OpenTestDataFile(file_name_);
-    ASSERT_TRUE(aom_ctx_->file != NULL)
+    ASSERT_NE(aom_ctx_->file, nullptr)
         << "Input file open failed. Filename: " << file_name_;
 
     ASSERT_EQ(file_is_webm(webm_ctx_, aom_ctx_), 1) << "file is not WebM";
@@ -62,7 +62,7 @@
   void FillFrame() {
     ASSERT_NE(aom_ctx_, nullptr);
     ASSERT_NE(webm_ctx_, nullptr);
-    ASSERT_TRUE(aom_ctx_->file != NULL);
+    ASSERT_NE(aom_ctx_->file, nullptr);
     const int status = webm_read_frame(webm_ctx_, &buf_, &frame_sz_, &buf_sz_);
     ASSERT_GE(status, 0) << "webm_read_frame failed";
     if (status == 1) {
@@ -73,7 +73,7 @@
   void SeekToNextKeyFrame() {
     ASSERT_NE(aom_ctx_, nullptr);
     ASSERT_NE(webm_ctx_, nullptr);
-    ASSERT_TRUE(aom_ctx_->file != NULL);
+    ASSERT_NE(aom_ctx_->file, nullptr);
     do {
       const int status =
           webm_read_frame(webm_ctx_, &buf_, &frame_sz_, &buf_sz_);
diff --git a/test/y4m_test.cc b/test/y4m_test.cc
index 1109ab8..3e87369 100644
--- a/test/y4m_test.cc
+++ b/test/y4m_test.cc
@@ -78,7 +78,7 @@
 
   // Checks y4m header information
   void HeaderChecks(unsigned int bit_depth, aom_img_fmt_t fmt) {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     ASSERT_EQ(y4m_.pic_w, (int)kWidth);
     ASSERT_EQ(y4m_.pic_h, (int)kHeight);
     ASSERT_EQ(img()->d_w, kWidth);
@@ -104,7 +104,7 @@
 
   // Checks MD5 of the raw frame data
   void Md5Check(const string &expected_md5) {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     libaom_test::MD5 md5;
     for (unsigned int i = start_; i < limit_; i++) {
       md5.Add(img());
@@ -143,12 +143,12 @@
 
   // Writes out a y4m file and then reads it back
   void WriteY4mAndReadBack() {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     char buf[Y4M_BUFFER_SIZE] = { 0 };
     const struct AvxRational framerate = { y4m_.fps_n, y4m_.fps_d };
     tmpfile_ = new libaom_test::TempOutFile;
-    ASSERT_TRUE(tmpfile_ != NULL);
-    ASSERT_TRUE(tmpfile_->file() != NULL);
+    ASSERT_NE(tmpfile_, nullptr);
+    ASSERT_NE(tmpfile_->file(), nullptr);
     y4m_write_file_header(buf, sizeof(buf), kWidth, kHeight, &framerate,
                           img()->monochrome, img()->csp, y4m_.aom_fmt,
                           y4m_.bit_depth, AOM_CR_STUDIO_RANGE);
diff --git a/test/y4m_video_source.h b/test/y4m_video_source.h
index 63f74f5..143fbc6 100644
--- a/test/y4m_video_source.h
+++ b/test/y4m_video_source.h
@@ -36,12 +36,12 @@
   virtual void OpenSource() {
     CloseSource();
     input_file_ = OpenTestDataFile(file_name_);
-    ASSERT_TRUE(input_file_ != NULL)
+    ASSERT_NE(input_file_, nullptr)
         << "Input file open failed. Filename: " << file_name_;
   }
 
   virtual void ReadSourceToStart() {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     ASSERT_FALSE(
         y4m_input_open(&y4m_, input_file_, NULL, 0, AOM_CSP_UNKNOWN, 0));
     framerate_numerator_ = y4m_.fps_n;
@@ -82,7 +82,7 @@
   virtual unsigned int limit() const { return limit_; }
 
   virtual void FillFrame() {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     // Read a frame from input_file.
     y4m_input_fetch_frame(&y4m_, input_file_, img_.get());
   }
diff --git a/test/yuv_video_source.h b/test/yuv_video_source.h
index b6bf71d..15ad5c2 100644
--- a/test/yuv_video_source.h
+++ b/test/yuv_video_source.h
@@ -44,7 +44,7 @@
   virtual void Begin() {
     if (input_file_) fclose(input_file_);
     input_file_ = OpenTestDataFile(file_name_);
-    ASSERT_TRUE(input_file_ != NULL)
+    ASSERT_NE(input_file_, nullptr)
         << "Input file open failed. Filename: " << file_name_;
     if (start_)
       fseek(input_file_, static_cast<unsigned>(raw_size_) * start_, SEEK_SET);
@@ -79,7 +79,7 @@
     if (width != width_ || height != height_ || format != format_) {
       aom_img_free(img_);
       img_ = aom_img_alloc(NULL, format, width, height, 1);
-      ASSERT_TRUE(img_ != NULL);
+      ASSERT_NE(img_, nullptr);
       width_ = width;
       height_ = height;
       format_ = format;
@@ -97,7 +97,7 @@
   }
 
   virtual void FillFrame() {
-    ASSERT_TRUE(input_file_ != NULL);
+    ASSERT_NE(input_file_, nullptr);
     // Read a frame from input_file.
     if (fread(img_->img_data, raw_size_, 1, input_file_) == 0) {
       limit_ = frame_;