mod row;
mod rows;
mod column_index;
pub use row::*;
pub use rows::*;
pub use column_index::*;
#[cfg(test)]
mod tests {
use crate::AkitaValue;
use super::*;
#[test]
fn test_rows_creation() {
let rows = Rows::new();
assert!(rows.is_empty());
assert_eq!(rows.len(), 0);
}
#[test]
fn test_row_operations() {
let columns = vec!["id".to_string(), "name".to_string()];
let data = vec![AkitaValue::Int(1), AkitaValue::Text("test".to_string())];
let row = Row::new(columns, data);
assert_eq!(row.len(), 2);
assert!(row.contains_column("id"));
assert!(!row.contains_column("nonexistent"));
assert_eq!(row.get::<i32, _>(0), Some(1));
assert_eq!(row.get_by_column::<String>("name"), Some("test".to_string()));
}
#[test]
fn test_rows_iteration() {
let mut rows = Rows::new();
let row1 = Row::new(
vec!["id".to_string(), "name".to_string()],
vec![AkitaValue::Int(1), AkitaValue::Text("Alice".to_string())],
);
let row2 = Row::new(
vec!["id".to_string(), "name".to_string()],
vec![AkitaValue::Int(2), AkitaValue::Text("Bob".to_string())],
);
rows.push(row1);
rows.push(row2);
let mut count = 0;
for row in &rows {
assert_eq!(row.len(), 2);
count += 1;
}
assert_eq!(count, 2);
let objects: Vec<AkitaValue> = rows.object_iter().collect();
assert_eq!(objects.len(), 2);
}
}