2015-07-21 11:36:45 +08:00
|
|
|
// This file is part of libfringe, a low-level green threading library.
|
2016-07-18 02:12:56 +08:00
|
|
|
// Copyright (c) Ben Segall <talchas@gmail.com>
|
|
|
|
// Copyright (c) edef <edef@edef.eu>
|
2015-07-21 11:36:45 +08:00
|
|
|
// See the LICENSE file included in this distribution.
|
|
|
|
#![cfg(target_os = "linux")]
|
|
|
|
#![feature(test)]
|
|
|
|
#![feature(thread_local)]
|
|
|
|
#![feature(asm)]
|
|
|
|
extern crate fringe;
|
|
|
|
extern crate test;
|
2016-08-09 21:59:35 +08:00
|
|
|
use fringe::{OsStack, Generator};
|
2015-07-21 11:36:45 +08:00
|
|
|
use test::black_box;
|
|
|
|
|
|
|
|
const FE_DIVBYZERO: i32 = 0x4;
|
|
|
|
extern {
|
|
|
|
fn feenableexcept(except: i32) -> i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn fpe() {
|
2016-08-09 21:59:35 +08:00
|
|
|
let stack = OsStack::new(0).unwrap();
|
2016-08-12 05:04:40 +08:00
|
|
|
let mut gen = Generator::new(stack, move |yielder, ()| {
|
2016-08-09 21:59:35 +08:00
|
|
|
yielder.generate(1.0 / black_box(0.0));
|
|
|
|
});
|
2015-07-21 11:36:45 +08:00
|
|
|
|
2016-08-09 21:59:35 +08:00
|
|
|
unsafe { feenableexcept(FE_DIVBYZERO); }
|
2016-08-12 05:04:40 +08:00
|
|
|
println!("{:?}", gen.resume(()));
|
2015-07-21 11:36:45 +08:00
|
|
|
}
|