/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2019 Danny Robson */ #include "thread/thread.hpp" #include "tap.hpp" #include static void run (std::atomic &val) { ++val; } int main () { cruft::TAP::logger tap; // Get the thread to increment an int. If it's been incremented once after // joining then we assume the thread ran successfully. std::atomic val = 0; cruft::thread::thread dude (run, std::ref (val)); dude.join (); tap.expect_eq (val.load (), 1, "thread appears to have run"); return tap.status (); }