2016-07-17 08:34:26 +08:00
|
|
|
// This file is part of libfringe, a low-level green threading library.
|
|
|
|
// Copyright (c) whitequark <whitequark@whitequark.org>
|
|
|
|
// See the LICENSE file included in this distribution.
|
|
|
|
extern crate fringe;
|
|
|
|
|
|
|
|
use fringe::{Stack, OsStack};
|
|
|
|
|
|
|
|
#[test]
|
2016-07-17 09:24:20 +08:00
|
|
|
fn default_stack() {
|
|
|
|
let stack = OsStack::new(0).unwrap();
|
|
|
|
// Make sure the topmost page of the stack, at least, is accessible.
|
2016-08-12 07:18:36 +08:00
|
|
|
unsafe { *(stack.base().offset(-1)) = 0; }
|
2016-07-17 09:24:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn one_page_stack() {
|
2016-07-17 08:34:26 +08:00
|
|
|
let stack = OsStack::new(4096).unwrap();
|
|
|
|
// Make sure the topmost page of the stack, at least, is accessible.
|
2016-08-12 07:18:36 +08:00
|
|
|
unsafe { *(stack.base().offset(-1)) = 0; }
|
2016-07-17 08:34:26 +08:00
|
|
|
}
|