#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub struct CooLayout {
pub nnz: u64,
pub is_sorted: bool,
}
impl CooLayout {
pub fn new(nnz: u64, is_sorted: bool) -> Self {
Self { nnz, is_sorted }
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::layout::LayoutDescriptor;
#[test]
fn coo_tag_is_0x06() {
let layout = LayoutDescriptor::Coo(CooLayout::new(0, false));
assert_eq!(layout.tag(), 0x06);
}
#[test]
fn coo_buffer_count_is_2() {
use std::num::NonZeroU8;
let layout = LayoutDescriptor::Coo(CooLayout::new(100, true));
assert_eq!(layout.buffer_count(), Some(NonZeroU8::new(2).unwrap()));
}
}