slint/tests/cases/expr/trigo.60
2021-07-02 15:55:54 +02:00

40 lines
1.2 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
TestCase := Rectangle {
property <bool> verify:
sin(0) == 0 &&
cos(0) == 1 &&
round(1000* cos(360deg)) == 1000 && round(1000*sin(360deg)) == 0 &&
round(1000* sin(180deg)) == 0 && round(1000*cos(180deg)) == -1000 &&
round(1000 * sin(90deg)) == 1000 && round(1000*cos(90deg)) == 0 &&
round(atan(tan(45deg))/0.1deg) == 450 &&
round(asin(sin(45deg))/0.1deg) == 450 &&
round(acos(cos(45deg))/0.1deg) == 450 &&
true;
property <bool> test: verify;
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert(instance.get_verify());
```
```rust
let instance = TestCase::new();
assert!(instance.get_verify());
```
```js
var instance = new sixtyfps.TestCase({});
assert(instance.verify);
```
*/