|
|
#include <gp/algorithm/foreach.hpp>
|
|
#include <gp/allocator/buddy.hpp>
|
|
#include <gp/array.hpp>
|
|
#include <gp/enveloppe/cbor.hpp>
|
|
#include <gp/vfs/system.hpp>
|
|
#include "test_scaffold.h"
|
|
|
|
#include <atomic>
|
|
|
|
struct channel_test : public test_scaffold {
|
|
channel_test() {
|
|
name = __FILE__ ":1";
|
|
}
|
|
|
|
virtual int run() {
|
|
auto store = std::make_unique<gp::array<char, 4096*512>>();
|
|
gp::buddy<> alloc{&*store->begin(), store->size()};
|
|
gp::system sys{alloc, 1};
|
|
|
|
std::atomic_int a = 0;
|
|
|
|
sys.spawn(gp::function<void()>{[&](){
|
|
a.fetch_add(1);
|
|
}, alloc});
|
|
|
|
sys.run_once();
|
|
|
|
gp_config::assertion(a.load(), "did not increment (aka run the fiber)");
|
|
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
append_test dummy_hke41r43(new channel_test{});
|