Shorten test names

This commit is contained in:
Richard Feldman 2019-03-14 21:18:38 -04:00
parent f03fcbd0c2
commit d57716ffe6

View File

@ -15,35 +15,35 @@ mod tests {
use combine::{Parser};
#[test]
fn test_parse_positive_int() {
fn parse_positive_int() {
assert_eq!(Ok((Int(1234), "")), parse::number_literal().parse("1234"));
}
#[test]
fn test_parse_negative_int() {
fn parse_negative_int() {
assert_eq!(Ok((Int(-1234), "")), parse::number_literal().parse("-1234"));
}
#[test]
fn test_parse_positive_ratio() {
fn parse_positive_ratio() {
assert_eq!(Ok((Ratio(12345, 100), "")), parse::number_literal().parse("123.45"));
assert_eq!(Ok((Ratio(4200, 100), "")), parse::number_literal().parse("42.00"));
}
#[test]
fn test_parse_negative_ratio() {
fn parse_negative_ratio() {
assert_eq!(Ok((Ratio(-1234567, 1000), "")), parse::number_literal().parse("-1234.567"));
assert_eq!(Ok((Ratio(-1920, 10), "")), parse::number_literal().parse("-192.0"));
}
#[test]
fn test_parse_ints_with_spaces() {
fn parse_ints_with_spaces() {
assert_eq!(Ok((Int(987654321), "")), parse::number_literal().parse("987 6 5 432 1"));
assert_eq!(Ok((Int(-1234567890), "")), parse::number_literal().parse("-1 234 567 890"));
}
#[test]
fn test_parse_ratios_with_spaces() {
fn parse_ratios_with_spaces() {
assert_eq!(Ok((Ratio(-1234567, 1000), "")), parse::number_literal().parse("-1 23 4.567"));
assert_eq!(Ok((Ratio(-1920, 10), "")), parse::number_literal().parse("-19 2.0"));
assert_eq!(Ok((Ratio(12345, 100), "")), parse::number_literal().parse("1 2 3.45"));
@ -51,7 +51,7 @@ mod tests {
}
#[test]
fn test_parse_single_operator() {
fn parse_single_operator() {
match parse::expr().parse("1234 + 567") {
Ok((CallOperator(v1, op, v2), "")) => {
assert_eq!(*v1, Int(1234));
@ -63,7 +63,7 @@ mod tests {
}
#[test]
fn test_parse_multiple_operators() {
fn parse_multiple_operators() {
#![feature(box_syntax, box_patterns)]
match parse::expr().parse("1 + 2 * 3") {
Ok((CallOperator(box v1, op1, box CallOperator(box v2, op2, box v3)), "")) => {