Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running tests with --no-default-features #77

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ jobs:
- name: Run tests
run: cargo test --verbose

test_no_default_features:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Build
run: cargo build --no-default-features --verbose
- name: Run tests
run: cargo test --no-default-features --verbose

# We have to test the MSRV without the zip crate, since the zip crate has a higher MSRV and
# doesn't consider a MSRV update to be a breaking change.
test_msrv:
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ndarray_npy::{
write_zeroed_npy, ReadNpyError, ReadNpyExt, ViewMutNpyExt, ViewNpyError, ViewNpyExt,
WriteNpyExt,
};
#[cfg(feature = "num-complex-0_4")]
use num_complex_0_4::Complex;
use std::fs::{self, File};
use std::io::{Read, Seek, SeekFrom, Write};
Expand All @@ -29,6 +30,7 @@ fn write_f64_standard() {
assert_eq!(&correct, &writer);
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn write_c64_standard() {
#[cfg(target_endian = "little")]
Expand Down Expand Up @@ -65,6 +67,7 @@ fn write_f64_fortran() {
assert_eq!(&correct[..], &writer[..]);
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn write_c64_fortran() {
#[cfg(target_endian = "little")]
Expand Down Expand Up @@ -103,6 +106,7 @@ fn write_f64_discontiguous() {
assert_eq!(&correct, &writer);
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn write_c64_discontiguous() {
#[cfg(target_endian = "little")]
Expand Down Expand Up @@ -141,6 +145,7 @@ fn read_f64_standard() {
}
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn read_c64_standard() {
let mut correct = Array3::<Complex<f64>>::zeros((2, 3, 4));
Expand Down Expand Up @@ -175,6 +180,7 @@ fn read_f64_fortran() {
}
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn read_c64_fortran() {
let mut correct = Array3::<Complex<f64>>::zeros((2, 3, 4).f());
Expand Down Expand Up @@ -230,6 +236,7 @@ fn view_f64_standard() {
assert!(view.is_standard_layout());
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn view_c64_standard() {
#[cfg(target_endian = "little")]
Expand Down Expand Up @@ -266,6 +273,7 @@ fn view_f64_fortran() {
assert!(view.t().is_standard_layout());
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn view_c64_fortran() {
#[cfg(target_endian = "little")]
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/round_trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use ndarray_npy::{
ReadNpyExt, ReadableElement, ViewElement, ViewMutElement, ViewMutNpyExt, ViewNpyExt,
WritableElement, WriteNpyExt,
};
#[cfg(feature = "num-complex-0_4")]
use num_complex_0_4::Complex;
use std::fmt::Debug;
use std::mem;
Expand Down Expand Up @@ -149,6 +150,7 @@ fn round_trip_f64() {
);
}

#[cfg(feature = "num-complex-0_4")]
#[test]
fn round_trip_c32() {
test_round_trip_multiple_layouts(
Expand Down