summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-07-03 21:09:25 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-07-03 21:09:25 +0200
commitabf5a81473c56c43bd6e4476632eb9ab20f6872c (patch)
tree39e11aa010258d2c6d02daccbbf3e955a86683db /src
parent1b500ca660937893785705be25b8064dd321024b (diff)
Updated tests to match new label format
Diffstat (limited to 'src')
-rw-r--r--src/transforms.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/transforms.rs b/src/transforms.rs
index 229af23..5fa1186 100644
--- a/src/transforms.rs
+++ b/src/transforms.rs
@@ -207,7 +207,7 @@ pub fn hz_to_pitch(hz: f64) -> String {
let name = pitch_names[rounded_pitch as usize % pitch_names.len()].to_string();
let octave = rounded_pitch / pitch_names.len() as i32 - 1; //0 is C-1
if octave < 0 {
- return "< C1".to_string();
+ return "< C 1".to_string();
}
format!("{}{}", name, octave)
@@ -215,22 +215,22 @@ pub fn hz_to_pitch(hz: f64) -> String {
#[test]
fn a4_is_correct() {
- assert_eq!(hz_to_pitch(440.0), "A4 +0");
+ assert_eq!(hz_to_pitch(440.0), "A 4");
}
#[test]
fn a2_is_correct() {
- assert_eq!(hz_to_pitch(110.0), "A2 +0");
+ assert_eq!(hz_to_pitch(110.0), "A 2");
}
#[test]
fn c4_is_correct() {
- assert_eq!(hz_to_pitch(261.63), "C4 +0");
+ assert_eq!(hz_to_pitch(261.63), "C 4");
}
#[test]
fn f5_is_correct() {
- assert_eq!(hz_to_pitch(698.46), "F5 +0");
+ assert_eq!(hz_to_pitch(698.46), "F 5");
}