pub mod anticheat;
pub mod complexity;
pub mod coverage;
pub mod differential;
pub mod educational;
pub mod formal;
pub mod golden;
pub mod grading;
pub mod incremental;
pub mod integration;
pub mod migration;
pub mod mutation;
pub mod performance;
pub mod progressive;
pub mod property;
pub mod report;
pub mod sandbox;
pub mod smt;
pub mod state;
pub mod tester;
pub mod tutorial;
pub mod types;
pub use tester::{NotebookParser as TestNotebookParser, NotebookTestSession, NotebookTester};
pub use types::TestConfig;
pub use anticheat::{ObfuscationDetector, PatternAnalyzer, PlagiarismResult, Submission};
pub use complexity::{
ComplexityConfig, ComplexityResult, Hotspot, SpaceComplexity, TimeComplexity,
};
pub use differential::{DifferentialConfig, DifferentialResult, DivergenceType};
pub use educational::{
Assignment, FeedbackSeverity, Grade, LearningAnalytics, LearningEvent, RubricItem,
StudentSubmission, TestCase as EduTestCase,
};
pub use formal::{
Constraint, ConstraintSeverity, ExecutionPath, FormalConfig, FunctionSpec, Invariant,
LoopInvariant, VerificationResult,
};
pub use grading::{Difficulty, Exercise, ExerciseValidator, GradingConfig, ValidationResult};
pub use incremental::{IncrementalConfig, IncrementalResult, TestResultCache};
pub use integration::{Alert, AlertAction, CiCdConfig, CiProvider, ContinuousMonitor, Metric};
pub use migration::{MigrationConfig, MigrationResult, MigrationTool, TestFramework};
pub use mutation::{Mutation, MutationConfig, MutationResult, MutationType};
pub use performance::{
BenchmarkResult, CacheStats, RegressionDetector, RegressionResult, ResourceMonitor,
ResourceUsage, TestCache, TestPrioritizer, TestSharder,
};
pub use progressive::{DisclosureConfig, StudentProgress, TestHierarchy};
pub use property::{PropertyTestConfig, PropertyTester};
pub use sandbox::{
ExecutionResult, Exercise as SandboxExercise, ProblemGenerator, ResourceLimits,
SandboxCoordinator, SandboxError, WasmSandbox,
};
pub use smt::{BoundedModelChecker, SmtQuery, SmtResult, SolverType};
pub use state::TestState;
pub use tutorial::{AdaptiveHintSystem, StepResult, TutorialStep, ValidationRule};
pub use types::{
Cell,
CellMetadata,
CellOutput,
CellTestMetadata,
CellTestType,
CellType,
CoverageReport,
DataFrameData,
Notebook,
NotebookMetadata,
NotebookParser,
PlotData,
TestFailure,
TestReport,
};
pub fn test_notebook(path: &std::path::Path, _config: TestConfig) -> anyhow::Result<TestReport> {
let tester_config = crate::notebook::testing::tester::TestConfig::default();
let tester = NotebookTester::with_config(tester_config);
tester.test_file(path)
}
#[cfg(test)]
mod tests {
use super::*;
use std::path::PathBuf;
use tempfile::NamedTempFile;
#[test]
fn test_test_notebook_function_exists() {
let temp_file = NamedTempFile::new().unwrap();
let config = TestConfig::new();
let result = test_notebook(temp_file.path(), config);
assert!(result.is_err());
}
#[test]
fn test_test_notebook_with_invalid_path() {
let config = TestConfig::new();
let invalid_path = PathBuf::from("/nonexistent/path/test.ipynb");
let result = test_notebook(&invalid_path, config);
assert!(result.is_err());
}
#[test]
fn test_test_config_usage() {
let config = TestConfig::new();
assert_eq!(config.tolerance, 1e-6);
assert!(!config.coverage);
assert!(!config.mutation);
}
#[test]
fn test_notebook_tester_usage() {
let config = crate::notebook::testing::tester::TestConfig::default();
let _tester = NotebookTester::with_config(config);
}
#[test]
fn test_differential_types_accessible() {
let _config = DifferentialConfig::default();
let _divergence = DivergenceType::None;
}
#[test]
fn test_formal_types_accessible() {
let _config = FormalConfig::default();
let _severity = ConstraintSeverity::Error;
}
#[test]
fn test_grading_types_accessible() {
let _config = GradingConfig::default();
let _difficulty = Difficulty::Easy;
}
#[test]
fn test_integration_types_accessible() {
let _provider = CiProvider::GitHub;
let _action = AlertAction::Email("test@example.com".to_string());
}
#[test]
fn test_mutation_types_accessible() {
let _config = MutationConfig::default();
let _mutation_type = MutationType::ArithmeticOperator;
}
#[test]
fn test_sandbox_types_accessible() {
let _limits = ResourceLimits::educational();
let _error = SandboxError::Timeout;
}
#[test]
fn test_smt_types_accessible() {
let _solver_type = SolverType::Z3;
let _result = SmtResult::Satisfiable;
}
#[test]
fn test_state_types_accessible() {
let _state = TestState::new();
}
#[test]
fn test_tutorial_types_accessible() {
let _rule = ValidationRule::OutputEquals("test".to_string());
}
#[test]
fn test_types_module_accessible() {
let _cell_type = CellType::Code;
let _output = CellOutput::None;
}
#[test]
fn test_anticheat_types_accessible() {
let _submission = Submission {
student_id: "test".to_string(),
assignment_id: "test_assignment".to_string(),
code: "test code".to_string(),
timestamp: chrono::Utc::now(),
fingerprint: "test_fingerprint".to_string(),
};
}
#[test]
fn test_complexity_types_accessible() {
let _config = ComplexityConfig::default();
let _time_complexity = TimeComplexity::O1;
let _space_complexity = SpaceComplexity::O1;
}
#[test]
fn test_educational_types_accessible() {
let _severity = FeedbackSeverity::Info;
let _grade = Grade {
total_points: 100,
max_points: 100,
percentage: 100.0,
feedback: vec![],
rubric_scores: std::collections::HashMap::new(),
};
}
#[test]
fn test_incremental_types_accessible() {
let _config = IncrementalConfig::default();
}
#[test]
fn test_migration_types_accessible() {
let _framework = TestFramework::Pytest;
let _config = MigrationConfig::default();
}
#[test]
fn test_performance_types_accessible() {
let _monitor = ResourceMonitor::new();
let _usage = ResourceUsage {
memory_mb: 0.0,
cpu_percent: 0.0,
duration_ms: 0,
peak_memory_mb: 0.0,
};
}
#[test]
fn test_progressive_types_accessible() {
let _config = DisclosureConfig::default();
}
#[test]
fn test_property_types_accessible() {
let _config = PropertyTestConfig::default();
}
#[test]
fn test_report_types_accessible() {
let _report = crate::notebook::testing::report::TestReport::new(100, 95, 5, 80.5);
assert_eq!(_report.total_tests, 100);
}
#[test]
fn test_golden_types_accessible() {
use std::path::Path;
let _manager = crate::notebook::testing::golden::GoldenManager::new(Path::new("/tmp"));
}
#[test]
fn test_module_structure_complete() {
let _test_config = TestConfig::new();
let _notebook_tester = NotebookTester::new();
let _cell_type_variants = [CellType::Code, CellType::Markdown];
let _divergence_variants = [
DivergenceType::None,
DivergenceType::OutputMismatch,
DivergenceType::TypeMismatch,
DivergenceType::PerformanceRegression,
DivergenceType::BothFailed,
];
assert_eq!(_cell_type_variants.len(), 2);
assert_eq!(_divergence_variants.len(), 5);
}
}