mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 13:01:05 +00:00
Fix functions unit tests for v < 1_12
This commit is contained in:
parent
65f548cd98
commit
ec3a11cec1
1 changed files with 8 additions and 3 deletions
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst_sys;
|
use gst_sys;
|
||||||
use std::mem;
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use Element;
|
use Element;
|
||||||
|
@ -111,6 +110,8 @@ pub fn calculate_linear_regression(
|
||||||
xy: &[(u64, u64)],
|
xy: &[(u64, u64)],
|
||||||
temp: Option<&mut [(u64, u64)]>,
|
temp: Option<&mut [(u64, u64)]>,
|
||||||
) -> Option<(u64, u64, u64, u64, f64)> {
|
) -> Option<(u64, u64, u64, u64, f64)> {
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
assert_eq!(mem::size_of::<u64>() * 2, mem::size_of::<(u64, u64)>());
|
assert_eq!(mem::size_of::<u64>() * 2, mem::size_of::<(u64, u64)>());
|
||||||
assert_eq!(mem::align_of::<u64>(), mem::align_of::<(u64, u64)>());
|
assert_eq!(mem::align_of::<u64>(), mem::align_of::<(u64, u64)>());
|
||||||
|
@ -143,10 +144,14 @@ pub fn calculate_linear_regression(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
#[cfg(feature = "v1_12")]
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_calculate_linear_regression() {
|
fn test_calculate_linear_regression() {
|
||||||
|
// Moved the module `use` inside test function because this is the only test for now
|
||||||
|
// and it is feature-gated, so it generates a warning when the feature is not selected.
|
||||||
|
// Can be moved out of the function when other tests are added.
|
||||||
|
use super::*;
|
||||||
|
|
||||||
::init().unwrap();
|
::init().unwrap();
|
||||||
|
|
||||||
let values = [(0, 0), (1, 1), (2, 2), (3, 3)];
|
let values = [(0, 0), (1, 1), (2, 2), (3, 3)];
|
||||||
|
|
Loading…
Reference in a new issue