verba 0.5.1

A library for working with Latin words.
Documentation
use unicode_normalization::{is_nfc};

/// Takes two Vec<String> arguments. The first is a value returned from 
/// either Noun::decline or Adjective::decline and the second is the expected
/// values. 
/// 
/// First the two arguments are checked to make sure they have the same 
/// length. If they are, then each element in the first argument's Unicode
/// normalized form is checked to be composed. If it is, then the function
/// checks if the element is stored in the second argument. If it is, then
/// the function returns true. 
pub fn verify_declension(declension: &Option<Vec<String>>, correct: &Option<Vec<String>>) {
    match (declension, correct) {
        (Some(declension), Some(correct)) => {
            assert!(declension.len() == correct.len(), "The Vecs `declension` and `correct` are not the same length.");

            for (index, form) in declension.iter().enumerate() {
                // First check to ensure the element is in normalized composed
                // form. If it's not, the second check may return false even if the
                // strings appears equal.
                assert!(is_nfc(form), "{} is not in normalized composed form.", form);

                assert!(form == &correct[index], "Element {}, {}, from `declension` is not equal to element {}, {}, from `correct`.", index, form, index, &correct[index]);
            }
        },
        (Some(_), None) => panic!("Vec `declension` contained data but `correct` was None."),
        (None, Some(_)) => panic!("Vec `declension` was None but `correct` contained data."),
        (None, None) => (),
    }
}