polylane 0.3.0

Portable and versatile SIMD.
Documentation
// Copyright 2025 Gabriel Bjørnager Jensen.
//
// This Source Code Form is subject to the terms of
// the Mozilla Public License, v. 2.0. If a copy of
// the MPL was not distributed with this file, you
// can obtain one at:
// <https://mozilla.org/MPL/2.0/>.

#![cfg(test)]

use polylane::prelude::*;

#[cfg(feature = "alloc")]
use alloc::vec::Vec;

#[test]
fn test_simd_index() {
	let v = f32x3::from_array([
		0.0,
		1.0,
		0.5,
	]);

	assert_eq!(
		v.as_slice(),
		&[0.0, 1.0, 1.5],
	);
}

#[cfg(feature = "alloc")]
#[test]
fn test_simd_iterator() {
	#[allow(clippy::approx_constant)]
	let values = [
		 0.196,
		 0.393,
		 0.785,
		 1.571,
		 3.142,
		 6.283,
		12.566,
		25.133,
		50.265,
	];

	let v: Vec<f64> = values.into_iter().collect();

	assert_eq!(
		v.as_slice(),
		&values,
	);
}