git subrepo pull (merge) --force deps/libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / zstd-1.5.5 / contrib / pzstd / utils / test / ScopeGuardTest.cpp
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under both the BSD-style license (found in the
6  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7  * in the COPYING file in the root directory of this source tree).
8  */
9 #include "utils/ScopeGuard.h"
10
11 #include <gtest/gtest.h>
12
13 using namespace pzstd;
14
15 TEST(ScopeGuard, Dismiss) {
16   {
17     auto guard = makeScopeGuard([&] { EXPECT_TRUE(false); });
18     guard.dismiss();
19   }
20 }
21
22 TEST(ScopeGuard, Executes) {
23   bool executed = false;
24   {
25     auto guard = makeScopeGuard([&] { executed = true; });
26   }
27   EXPECT_TRUE(executed);
28 }