From e37f7ba671f3e80396e7a4ac3a461365bd0ca78a Mon Sep 17 00:00:00 2001 From: jacksonfu14 Date: Mon, 17 Nov 2025 08:49:07 +0100 Subject: feature: ly processing batch chunking --- morphology-img/tests/config.rs | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'morphology-img/tests/config.rs') diff --git a/morphology-img/tests/config.rs b/morphology-img/tests/config.rs index 9b47ed5..6302cb0 100644 --- a/morphology-img/tests/config.rs +++ b/morphology-img/tests/config.rs @@ -183,3 +183,60 @@ fn test_new_is_equivalent_to_default_with_custom_output() { assert_eq!(config_new.keep_temp_files, config_default.keep_temp_files); assert_eq!(config_new.lilypond_binary, config_default.lilypond_binary); } + +#[test] +fn test_default_max_batch_size_is_none() { + let config = RenderConfig::default(); + assert_eq!(config.max_batch_size, None); +} + +#[test] +fn test_builder_max_batch_size() { + let config = RenderConfig::new("output") + .max_batch_size(50); + + assert_eq!(config.max_batch_size, Some(50)); + assert_eq!(config.output_dir, PathBuf::from("output")); +} + +#[test] +fn test_builder_max_batch_size_various_values() { + let config1 = RenderConfig::new("output").max_batch_size(1); + let config10 = RenderConfig::new("output").max_batch_size(10); + let config100 = RenderConfig::new("output").max_batch_size(100); + + assert_eq!(config1.max_batch_size, Some(1)); + assert_eq!(config10.max_batch_size, Some(10)); + assert_eq!(config100.max_batch_size, Some(100)); +} + +#[test] +fn test_builder_with_all_options_including_max_batch_size() { + let config = RenderConfig::new("my-output") + .keep_temp_files(true) + .lilypond_binary("/usr/bin/lilypond") + .max_batch_size(25); + + assert_eq!(config.output_dir, PathBuf::from("my-output")); + assert!(config.keep_temp_files); + assert_eq!(config.lilypond_binary, PathBuf::from("/usr/bin/lilypond")); + assert_eq!(config.max_batch_size, Some(25)); +} + +#[test] +fn test_builder_max_batch_size_overwrites() { + let config = RenderConfig::new("output") + .max_batch_size(10) + .max_batch_size(20); // Override previous value + + assert_eq!(config.max_batch_size, Some(20)); +} + +#[test] +fn test_max_batch_size_field_is_public() { + let config = RenderConfig::new("output").max_batch_size(15); + + // Should be able to access field directly + let _batch_size = config.max_batch_size; + assert_eq!(_batch_size, Some(15)); +} -- cgit v1.2.3