From 8e80407319b6e33c12108658d686391001c01599 Mon Sep 17 00:00:00 2001 From: James Sanderson Date: Sat, 23 Aug 2014 19:58:07 +0100 Subject: [PATCH] Rename hex_to_dec to hex_to_int --- src/hex.rs | 10 +++++----- src/hex_to_base64.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hex.rs b/src/hex.rs index cd51f13..145bc5d 100644 --- a/src/hex.rs +++ b/src/hex.rs @@ -1,4 +1,4 @@ -pub fn hex_to_dec(hex: char) -> int { +pub fn hex_to_int(hex: char) -> int { if hex >= '0' && hex <= '9' { hex as int - '0' as int } @@ -14,18 +14,18 @@ pub fn hex_to_dec(hex: char) -> int { fn all_hexes() { let hexes = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; for i in range(0u, hexes.len()) { - assert_eq!(hex_to_dec(hexes[i]), i as int); + assert_eq!(hex_to_int(hexes[i]), i as int); } } #[test] #[should_fail] fn test_too_large() { - hex_to_dec('g'); + hex_to_int('g'); } #[test] #[should_fail] fn test_too_small() { - hex_to_dec('/'); -} \ No newline at end of file + hex_to_int('/'); +} diff --git a/src/hex_to_base64.rs b/src/hex_to_base64.rs index 7d4e631..cf14f51 100644 --- a/src/hex_to_base64.rs +++ b/src/hex_to_base64.rs @@ -1,5 +1,5 @@ mod hex; fn main() { - println!("Output: {}", hex::hex_to_dec('0')); + println!("Output: {}", hex::hex_to_int('0')); }