1use crate::tutorial_system::{
7 Assessment, DifficultyLevel, LearningPath, SectionContent, Tutorial, TutorialCategory,
8 TutorialMetadata, TutorialSection, TutorialSystem,
9};
10use std::collections::HashMap;
11
12pub fn generate_beginner_tutorials() -> Vec<Tutorial> {
17 vec![
18 create_getting_started_tutorial(),
19 create_data_loading_tutorial(),
20 create_basic_regression_tutorial(),
21 create_basic_classification_tutorial(),
22 create_preprocessing_tutorial(),
23 ]
24}
25
26pub fn generate_intermediate_tutorials() -> Vec<Tutorial> {
31 vec![
32 create_pipeline_tutorial(),
33 create_cross_validation_tutorial(),
34 create_hyperparameter_tuning_tutorial(),
35 create_ensemble_methods_tutorial(),
36 create_feature_engineering_tutorial(),
37 ]
38}
39
40pub fn generate_advanced_tutorials() -> Vec<Tutorial> {
45 vec![
46 create_custom_estimator_tutorial(),
47 create_distributed_computing_tutorial(),
48 create_performance_optimization_tutorial(),
49 create_gpu_acceleration_tutorial(),
50 create_type_safety_tutorial(),
51 ]
52}
53
54pub fn create_beginner_learning_path() -> LearningPath {
56 LearningPath {
57 id: "beginner_path".to_string(),
58 title: "Beginner's Path to Machine Learning with sklears".to_string(),
59 description: "Complete learning path for mastering basic machine learning with sklears"
60 .to_string(),
61 difficulty: DifficultyLevel::Beginner,
62 estimated_hours: 12,
63 tutorial_sequence: generate_beginner_tutorials()
64 .iter()
65 .map(|t| t.id.clone())
66 .collect(),
67 prerequisites: vec![],
68 completion_rewards: vec![
69 "Understand core sklears concepts and APIs".to_string(),
70 "Load and preprocess data effectively".to_string(),
71 "Train and evaluate basic ML models".to_string(),
72 "Apply best practices for model development".to_string(),
73 ],
74 }
75}
76
77fn create_getting_started_tutorial() -> Tutorial {
79 Tutorial {
80 id: "getting_started".to_string(),
81 title: "Getting Started with sklears".to_string(),
82 description: "Learn the basics of sklears and build your first machine learning model"
83 .to_string(),
84 difficulty: DifficultyLevel::Beginner,
85 duration_minutes: 30,
86 prerequisites: vec![],
87 learning_objectives: vec![
88 "Understand the sklears architecture".to_string(),
89 "Install and configure sklears".to_string(),
90 "Build and train your first model".to_string(),
91 "Make predictions on new data".to_string(),
92 ],
93 sections: vec![
94 TutorialSection {
95 id: "intro".to_string(),
96 title: "Introduction to sklears".to_string(),
97 content: SectionContent::Text {
98 content: r#"
99# Welcome to sklears!
100
101sklears is a high-performance machine learning library for Rust, offering:
102
103- **14-20x performance (validated)** improvements over Python
104- **Type safety** at compile time
105- **Zero-cost abstractions** for ML algorithms
106- **scikit-learn compatible** API
107
108## Core Concepts
109
110sklears is built around several key traits:
111
112- `Estimator`: Base trait for all ML algorithms
113- `Fit`: Training interface
114- `Predict`: Prediction interface
115- `Transform`: Data transformation interface
116
117Let's see them in action!
118"#
119 .to_string(),
120 format: crate::tutorial_system::ContentFormat::Markdown,
121 },
122 interactive_elements: vec![],
123 estimated_duration: 5,
124 completion_criteria: crate::tutorial_system::CompletionCriteria {
125 required_interactions: vec![],
126 minimum_score: None,
127 time_spent_minimum: Some(60), code_execution_required: false,
129 },
130 },
131 TutorialSection {
132 id: "installation".to_string(),
133 title: "Installation and Setup".to_string(),
134 content: SectionContent::Text {
135 content: r#"
136# Installation
137
138Add sklears to your `Cargo.toml`:
139
140```toml
141[dependencies]
142sklears = "0.1.0"
143```
144
145For specific features:
146
147```toml
148[dependencies]
149sklears = { version = "0.1.0", features = ["full"] }
150```
151
152## Quick Test
153
154Let's verify your installation:
155
156```rust
157use sklears::prelude::*;
158
159fn main() {
160 println!("sklears version: {}", sklears::VERSION);
161}
162```
163"#
164 .to_string(),
165 format: crate::tutorial_system::ContentFormat::Markdown,
166 },
167 interactive_elements: vec![],
168 estimated_duration: 10,
169 completion_criteria: crate::tutorial_system::CompletionCriteria {
170 required_interactions: vec!["verify_install".to_string()],
171 minimum_score: None,
172 time_spent_minimum: Some(120),
173 code_execution_required: true,
174 },
175 },
176 TutorialSection {
177 id: "first_model".to_string(),
178 title: "Your First Model".to_string(),
179 content: SectionContent::Text {
180 content: r#"
181# Building Your First Model
182
183Let's create a simple linear regression model:
184
185```rust
186use sklears::prelude::*;
187use sklears::linear::LinearRegression;
188
189fn main() -> Result<()> {
190 // Create training data
191 let X = array![[1.0], [2.0], [3.0], [4.0], [5.0]];
192 let y = array![2.0, 4.0, 6.0, 8.0, 10.0];
193
194 // Create and train the model
195 let model = LinearRegression::builder()
196 .fit_intercept(true)
197 .build()?;
198
199 let trained = model.fit(&X, &y)?;
200
201 // Make predictions
202 let X_test = array![[6.0], [7.0]];
203 let predictions = trained.predict(&X_test)?;
204
205 println!("Predictions: {:?}", predictions);
206 // Expected: [12.0, 14.0]
207
208 Ok(())
209}
210```
211
212## Key Points
213
2141. **Builder Pattern**: Configure models using builders
2152. **Type Safety**: Compile-time checks prevent errors
2163. **Error Handling**: Use `Result<T>` for operations that can fail
2174. **Immutability**: Training returns a new trained model
218"#
219 .to_string(),
220 format: crate::tutorial_system::ContentFormat::Markdown,
221 },
222 interactive_elements: vec![],
223 estimated_duration: 15,
224 completion_criteria: crate::tutorial_system::CompletionCriteria {
225 required_interactions: vec!["first_model".to_string()],
226 minimum_score: None,
227 time_spent_minimum: Some(180),
228 code_execution_required: true,
229 },
230 },
231 ],
232 assessment: Some(Assessment {
233 id: "getting_started_quiz".to_string(),
234 title: "Getting Started Quiz".to_string(),
235 description: "Test your understanding of basic sklears concepts".to_string(),
236 questions: vec![],
237 time_limit: Some(600), passing_score: 0.7,
239 max_attempts: Some(3),
240 feedback_mode: crate::tutorial_system::FeedbackMode::Immediate,
241 }),
242 metadata: TutorialMetadata {
243 author: "sklears Team".to_string(),
244 created_at: chrono::Utc::now(),
245 updated_at: chrono::Utc::now(),
246 version: "1.0.0".to_string(),
247 tags: vec!["getting-started".to_string(), "beginner".to_string()],
248 category: TutorialCategory::GettingStarted,
249 language: "en".to_string(),
250 popularity_score: 5.0,
251 },
252 }
253}
254
255fn create_data_loading_tutorial() -> Tutorial {
257 Tutorial {
258 id: "data_loading".to_string(),
259 title: "Loading and Preparing Data".to_string(),
260 description: "Learn how to load data from various sources and prepare it for training"
261 .to_string(),
262 difficulty: DifficultyLevel::Beginner,
263 duration_minutes: 45,
264 prerequisites: vec!["getting_started".to_string()],
265 learning_objectives: vec![
266 "Load data from CSV files".to_string(),
267 "Use built-in datasets".to_string(),
268 "Create synthetic data for testing".to_string(),
269 "Handle missing values".to_string(),
270 ],
271 sections: vec![TutorialSection {
272 id: "builtin_datasets".to_string(),
273 title: "Built-in Datasets".to_string(),
274 content: SectionContent::Text {
275 content: r#"
276# Built-in Datasets
277
278sklears provides several built-in datasets for learning and testing:
279
280```rust
281use sklears::prelude::*;
282
283fn main() -> Result<()> {
284 // Load the classic iris dataset
285 let iris = load_iris()?;
286 println!("Features shape: {:?}", iris.features.shape());
287 println!("Number of classes: {}", iris.target_names.len());
288
289 // Create synthetic regression data
290 let (X, y) = make_regression()
291 .n_samples(100)
292 .n_features(5)
293 .noise(0.1)
294 .generate()?;
295
296 // Create synthetic classification data
297 let (X_class, y_class) = make_blobs()
298 .n_samples(200)
299 .n_features(2)
300 .centers(3)
301 .generate()?;
302
303 Ok(())
304}
305```
306
307## Available Datasets
308
309- `load_iris()`: Classic iris flower dataset
310- `load_diabetes()`: Diabetes regression dataset
311- `make_regression()`: Generate regression data
312- `make_blobs()`: Generate clustered data
313- `make_classification()`: Generate classification data
314"#
315 .to_string(),
316 format: crate::tutorial_system::ContentFormat::Markdown,
317 },
318 interactive_elements: vec![],
319 estimated_duration: 15,
320 completion_criteria: crate::tutorial_system::CompletionCriteria {
321 required_interactions: vec![],
322 minimum_score: None,
323 time_spent_minimum: Some(60), code_execution_required: false,
325 },
326 }],
327 assessment: None,
328 metadata: TutorialMetadata {
329 author: "sklears Team".to_string(),
330 created_at: chrono::Utc::now(),
331 updated_at: chrono::Utc::now(),
332 version: "1.0.0".to_string(),
333 tags: vec!["data".to_string(), "preprocessing".to_string()],
334 category: TutorialCategory::CoreConcepts,
335 language: "en".to_string(),
336 popularity_score: 4.5,
337 },
338 }
339}
340
341fn create_basic_regression_tutorial() -> Tutorial {
343 Tutorial {
344 id: "basic_regression".to_string(),
345 title: "Regression Models".to_string(),
346 description: "Master regression techniques from linear models to advanced methods"
347 .to_string(),
348 difficulty: DifficultyLevel::Beginner,
349 duration_minutes: 60,
350 prerequisites: vec!["getting_started".to_string(), "data_loading".to_string()],
351 learning_objectives: vec![
352 "Understand regression fundamentals".to_string(),
353 "Apply linear regression".to_string(),
354 "Use regularization techniques".to_string(),
355 "Evaluate regression models".to_string(),
356 ],
357 sections: vec![],
358 assessment: None,
359 metadata: TutorialMetadata {
360 author: "sklears Team".to_string(),
361 created_at: chrono::Utc::now(),
362 updated_at: chrono::Utc::now(),
363 version: "1.0.0".to_string(),
364 tags: vec!["regression".to_string(), "supervised".to_string()],
365 category: TutorialCategory::CoreConcepts,
366 language: "en".to_string(),
367 popularity_score: 4.8,
368 },
369 }
370}
371
372fn create_basic_classification_tutorial() -> Tutorial {
374 Tutorial {
375 id: "basic_classification".to_string(),
376 title: "Classification Models".to_string(),
377 description: "Learn classification from logistic regression to advanced classifiers"
378 .to_string(),
379 difficulty: DifficultyLevel::Beginner,
380 duration_minutes: 60,
381 prerequisites: vec!["getting_started".to_string(), "data_loading".to_string()],
382 learning_objectives: vec![
383 "Understand classification fundamentals".to_string(),
384 "Apply logistic regression".to_string(),
385 "Use decision trees".to_string(),
386 "Evaluate classifiers with metrics".to_string(),
387 ],
388 sections: vec![],
389 assessment: None,
390 metadata: TutorialMetadata {
391 author: "sklears Team".to_string(),
392 created_at: chrono::Utc::now(),
393 updated_at: chrono::Utc::now(),
394 version: "1.0.0".to_string(),
395 tags: vec!["classification".to_string(), "supervised".to_string()],
396 category: TutorialCategory::CoreConcepts,
397 language: "en".to_string(),
398 popularity_score: 4.9,
399 },
400 }
401}
402
403fn create_preprocessing_tutorial() -> Tutorial {
405 Tutorial {
406 id: "preprocessing".to_string(),
407 title: "Data Preprocessing".to_string(),
408 description: "Learn essential data preprocessing techniques".to_string(),
409 difficulty: DifficultyLevel::Beginner,
410 duration_minutes: 45,
411 prerequisites: vec!["data_loading".to_string()],
412 learning_objectives: vec![
413 "Normalize and standardize data".to_string(),
414 "Handle missing values".to_string(),
415 "Encode categorical variables".to_string(),
416 "Scale features appropriately".to_string(),
417 ],
418 sections: vec![],
419 assessment: None,
420 metadata: TutorialMetadata {
421 author: "sklears Team".to_string(),
422 created_at: chrono::Utc::now(),
423 updated_at: chrono::Utc::now(),
424 version: "1.0.0".to_string(),
425 tags: vec!["preprocessing".to_string(), "data".to_string()],
426 category: TutorialCategory::CoreConcepts,
427 language: "en".to_string(),
428 popularity_score: 4.6,
429 },
430 }
431}
432
433fn create_pipeline_tutorial() -> Tutorial {
435 Tutorial {
436 id: "pipelines".to_string(),
437 title: "Building ML Pipelines".to_string(),
438 description: "Create efficient ML pipelines for complex workflows".to_string(),
439 difficulty: DifficultyLevel::Intermediate,
440 duration_minutes: 75,
441 prerequisites: vec!["preprocessing".to_string()],
442 learning_objectives: vec![
443 "Understand pipeline architecture".to_string(),
444 "Chain transformers and estimators".to_string(),
445 "Build complex workflows".to_string(),
446 "Optimize pipeline performance".to_string(),
447 ],
448 sections: vec![],
449 assessment: None,
450 metadata: TutorialMetadata {
451 author: "sklears Team".to_string(),
452 created_at: chrono::Utc::now(),
453 updated_at: chrono::Utc::now(),
454 version: "1.0.0".to_string(),
455 tags: vec!["pipelines".to_string(), "workflows".to_string()],
456 category: TutorialCategory::AdvancedFeatures,
457 language: "en".to_string(),
458 popularity_score: 4.7,
459 },
460 }
461}
462
463fn create_cross_validation_tutorial() -> Tutorial {
464 Tutorial {
465 id: "cross_validation".to_string(),
466 title: "Model Validation Techniques".to_string(),
467 description: "Master cross-validation and model evaluation".to_string(),
468 difficulty: DifficultyLevel::Intermediate,
469 duration_minutes: 60,
470 prerequisites: vec!["basic_regression".to_string()],
471 learning_objectives: vec![],
472 sections: vec![],
473 assessment: None,
474 metadata: TutorialMetadata {
475 author: "sklears Team".to_string(),
476 created_at: chrono::Utc::now(),
477 updated_at: chrono::Utc::now(),
478 version: "1.0.0".to_string(),
479 tags: vec!["validation".to_string(), "evaluation".to_string()],
480 category: TutorialCategory::BestPractices,
481 language: "en".to_string(),
482 popularity_score: 4.5,
483 },
484 }
485}
486
487fn create_hyperparameter_tuning_tutorial() -> Tutorial {
488 Tutorial {
489 id: "hyperparameter_tuning".to_string(),
490 title: "Hyperparameter Optimization".to_string(),
491 description: "Optimize model performance with advanced tuning techniques".to_string(),
492 difficulty: DifficultyLevel::Intermediate,
493 duration_minutes: 90,
494 prerequisites: vec!["cross_validation".to_string()],
495 learning_objectives: vec![],
496 sections: vec![],
497 assessment: None,
498 metadata: TutorialMetadata {
499 author: "sklears Team".to_string(),
500 created_at: chrono::Utc::now(),
501 updated_at: chrono::Utc::now(),
502 version: "1.0.0".to_string(),
503 tags: vec!["optimization".to_string(), "tuning".to_string()],
504 category: TutorialCategory::AdvancedFeatures,
505 language: "en".to_string(),
506 popularity_score: 4.8,
507 },
508 }
509}
510
511fn create_ensemble_methods_tutorial() -> Tutorial {
512 Tutorial {
513 id: "ensemble_methods".to_string(),
514 title: "Ensemble Learning".to_string(),
515 description: "Combine multiple models for better predictions".to_string(),
516 difficulty: DifficultyLevel::Intermediate,
517 duration_minutes: 80,
518 prerequisites: vec!["basic_classification".to_string()],
519 learning_objectives: vec![],
520 sections: vec![],
521 assessment: None,
522 metadata: TutorialMetadata {
523 author: "sklears Team".to_string(),
524 created_at: chrono::Utc::now(),
525 updated_at: chrono::Utc::now(),
526 version: "1.0.0".to_string(),
527 tags: vec!["ensemble".to_string(), "advanced".to_string()],
528 category: TutorialCategory::AdvancedFeatures,
529 language: "en".to_string(),
530 popularity_score: 4.7,
531 },
532 }
533}
534
535fn create_feature_engineering_tutorial() -> Tutorial {
536 Tutorial {
537 id: "feature_engineering".to_string(),
538 title: "Feature Engineering".to_string(),
539 description: "Create powerful features for better model performance".to_string(),
540 difficulty: DifficultyLevel::Intermediate,
541 duration_minutes: 75,
542 prerequisites: vec!["preprocessing".to_string()],
543 learning_objectives: vec![],
544 sections: vec![],
545 assessment: None,
546 metadata: TutorialMetadata {
547 author: "sklears Team".to_string(),
548 created_at: chrono::Utc::now(),
549 updated_at: chrono::Utc::now(),
550 version: "1.0.0".to_string(),
551 tags: vec!["features".to_string(), "engineering".to_string()],
552 category: TutorialCategory::BestPractices,
553 language: "en".to_string(),
554 popularity_score: 4.9,
555 },
556 }
557}
558
559fn create_custom_estimator_tutorial() -> Tutorial {
561 Tutorial {
562 id: "custom_estimator".to_string(),
563 title: "Building Custom Estimators".to_string(),
564 description: "Create your own estimators using sklears traits".to_string(),
565 difficulty: DifficultyLevel::Advanced,
566 duration_minutes: 120,
567 prerequisites: vec!["pipelines".to_string()],
568 learning_objectives: vec![],
569 sections: vec![],
570 assessment: None,
571 metadata: TutorialMetadata {
572 author: "sklears Team".to_string(),
573 created_at: chrono::Utc::now(),
574 updated_at: chrono::Utc::now(),
575 version: "1.0.0".to_string(),
576 tags: vec!["custom".to_string(), "advanced".to_string()],
577 category: TutorialCategory::AdvancedFeatures,
578 language: "en".to_string(),
579 popularity_score: 4.4,
580 },
581 }
582}
583
584fn create_distributed_computing_tutorial() -> Tutorial {
585 Tutorial {
586 id: "distributed_computing".to_string(),
587 title: "Distributed Machine Learning".to_string(),
588 description: "Scale your ML workloads across multiple machines".to_string(),
589 difficulty: DifficultyLevel::Advanced,
590 duration_minutes: 150,
591 prerequisites: vec!["pipelines".to_string()],
592 learning_objectives: vec![],
593 sections: vec![],
594 assessment: None,
595 metadata: TutorialMetadata {
596 author: "sklears Team".to_string(),
597 created_at: chrono::Utc::now(),
598 updated_at: chrono::Utc::now(),
599 version: "1.0.0".to_string(),
600 tags: vec!["distributed".to_string(), "scaling".to_string()],
601 category: TutorialCategory::Performance,
602 language: "en".to_string(),
603 popularity_score: 4.3,
604 },
605 }
606}
607
608fn create_performance_optimization_tutorial() -> Tutorial {
609 Tutorial {
610 id: "performance_optimization".to_string(),
611 title: "Performance Optimization".to_string(),
612 description: "Squeeze maximum performance from your ML code".to_string(),
613 difficulty: DifficultyLevel::Advanced,
614 duration_minutes: 100,
615 prerequisites: vec!["pipelines".to_string()],
616 learning_objectives: vec![],
617 sections: vec![],
618 assessment: None,
619 metadata: TutorialMetadata {
620 author: "sklears Team".to_string(),
621 created_at: chrono::Utc::now(),
622 updated_at: chrono::Utc::now(),
623 version: "1.0.0".to_string(),
624 tags: vec!["performance".to_string(), "optimization".to_string()],
625 category: TutorialCategory::Performance,
626 language: "en".to_string(),
627 popularity_score: 4.6,
628 },
629 }
630}
631
632fn create_gpu_acceleration_tutorial() -> Tutorial {
633 Tutorial {
634 id: "gpu_acceleration".to_string(),
635 title: "GPU Acceleration".to_string(),
636 description: "Leverage GPU power for faster training".to_string(),
637 difficulty: DifficultyLevel::Advanced,
638 duration_minutes: 90,
639 prerequisites: vec!["performance_optimization".to_string()],
640 learning_objectives: vec![],
641 sections: vec![],
642 assessment: None,
643 metadata: TutorialMetadata {
644 author: "sklears Team".to_string(),
645 created_at: chrono::Utc::now(),
646 updated_at: chrono::Utc::now(),
647 version: "1.0.0".to_string(),
648 tags: vec!["gpu".to_string(), "acceleration".to_string()],
649 category: TutorialCategory::Performance,
650 language: "en".to_string(),
651 popularity_score: 4.7,
652 },
653 }
654}
655
656fn create_type_safety_tutorial() -> Tutorial {
657 Tutorial {
658 id: "type_safety".to_string(),
659 title: "Advanced Type Safety".to_string(),
660 description: "Leverage Rust's type system for safer ML code".to_string(),
661 difficulty: DifficultyLevel::Advanced,
662 duration_minutes: 110,
663 prerequisites: vec!["custom_estimator".to_string()],
664 learning_objectives: vec![],
665 sections: vec![],
666 assessment: None,
667 metadata: TutorialMetadata {
668 author: "sklears Team".to_string(),
669 created_at: chrono::Utc::now(),
670 updated_at: chrono::Utc::now(),
671 version: "1.0.0".to_string(),
672 tags: vec!["types".to_string(), "safety".to_string()],
673 category: TutorialCategory::BestPractices,
674 language: "en".to_string(),
675 popularity_score: 4.2,
676 },
677 }
678}
679
680pub fn create_complete_tutorial_system() -> TutorialSystem {
682 let mut all_tutorials = Vec::new();
683 all_tutorials.extend(generate_beginner_tutorials());
684 all_tutorials.extend(generate_intermediate_tutorials());
685 all_tutorials.extend(generate_advanced_tutorials());
686
687 let learning_paths = vec![
688 create_beginner_learning_path(),
689 create_intermediate_learning_path(),
690 create_advanced_learning_path(),
691 ];
692
693 TutorialSystem {
694 tutorials: all_tutorials,
695 learning_paths,
696 progress_tracker: crate::tutorial_system::ProgressTracker {
697 user_progress: HashMap::new(),
698 global_statistics: crate::tutorial_system::GlobalStatistics {
699 total_users: 0,
700 tutorial_completion_rates: HashMap::new(),
701 average_scores: HashMap::new(),
702 popular_tutorials: vec![],
703 common_challenges: vec![],
704 },
705 },
706 assessment_engine: crate::tutorial_system::AssessmentEngine {
707 assessments: HashMap::new(),
708 question_bank: vec![],
709 scoring_algorithms: HashMap::new(),
710 },
711 config: crate::tutorial_system::TutorialConfig::default(),
712 }
713}
714
715fn create_intermediate_learning_path() -> LearningPath {
717 LearningPath {
718 id: "intermediate_path".to_string(),
719 title: "Intermediate Machine Learning".to_string(),
720 description: "Advanced techniques and best practices".to_string(),
721 difficulty: DifficultyLevel::Intermediate,
722 estimated_hours: 20,
723 tutorial_sequence: generate_intermediate_tutorials()
724 .iter()
725 .map(|t| t.id.clone())
726 .collect(),
727 prerequisites: vec!["beginner_path".to_string()],
728 completion_rewards: vec![
729 "Build complex ML pipelines".to_string(),
730 "Optimize model performance".to_string(),
731 "Apply ensemble methods".to_string(),
732 ],
733 }
734}
735
736fn create_advanced_learning_path() -> LearningPath {
738 LearningPath {
739 id: "advanced_path".to_string(),
740 title: "Advanced sklears Mastery".to_string(),
741 description: "Master advanced features and optimization".to_string(),
742 difficulty: DifficultyLevel::Advanced,
743 estimated_hours: 35,
744 tutorial_sequence: generate_advanced_tutorials()
745 .iter()
746 .map(|t| t.id.clone())
747 .collect(),
748 prerequisites: vec!["intermediate_path".to_string()],
749 completion_rewards: vec![
750 "Create custom estimators".to_string(),
751 "Optimize performance at scale".to_string(),
752 "Leverage advanced type safety".to_string(),
753 ],
754 }
755}
756
757#[cfg(test)]
758mod tests {
759 use super::*;
760
761 #[test]
762 fn test_beginner_tutorials() {
763 let tutorials = generate_beginner_tutorials();
764 assert_eq!(tutorials.len(), 5);
765 assert_eq!(tutorials[0].id, "getting_started");
766 }
767
768 #[test]
769 fn test_intermediate_tutorials() {
770 let tutorials = generate_intermediate_tutorials();
771 assert_eq!(tutorials.len(), 5);
772 assert!(tutorials
773 .iter()
774 .all(|t| matches!(t.difficulty, DifficultyLevel::Intermediate)));
775 }
776
777 #[test]
778 fn test_advanced_tutorials() {
779 let tutorials = generate_advanced_tutorials();
780 assert_eq!(tutorials.len(), 5);
781 assert!(tutorials
782 .iter()
783 .all(|t| matches!(t.difficulty, DifficultyLevel::Advanced)));
784 }
785
786 #[test]
787 fn test_complete_system() {
788 let system = create_complete_tutorial_system();
789 assert_eq!(system.tutorials.len(), 15);
790 assert_eq!(system.learning_paths.len(), 3);
791 }
792
793 #[test]
794 fn test_learning_path_structure() {
795 let path = create_beginner_learning_path();
796 assert_eq!(path.id, "beginner_path");
797 assert_eq!(path.tutorial_sequence.len(), 5);
798 assert!(path.prerequisites.is_empty());
799 }
800
801 #[test]
802 fn test_tutorial_metadata() {
803 let tutorial = create_getting_started_tutorial();
804 assert_eq!(tutorial.metadata.author, "sklears Team");
805 assert!(tutorial
806 .metadata
807 .tags
808 .contains(&"getting-started".to_string()));
809 }
810}