From f794fd532c74583ef39ed64a164117ea649b6cfb Mon Sep 17 00:00:00 2001 From: Bauke Date: Fri, 8 Apr 2022 00:18:12 +0200 Subject: [PATCH] Add a 257-bit number test. --- source/add_binary/mod.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source/add_binary/mod.rs b/source/add_binary/mod.rs index 5d713c7..4eb73d9 100644 --- a/source/add_binary/mod.rs +++ b/source/add_binary/mod.rs @@ -65,4 +65,35 @@ fn test_add_binary() { assert_eq!(add_binary("11".to_string(), "1".to_string()), "100"); assert_eq!(add_binary("1010".to_string(), "1011".to_string()), "10101"); assert_eq!(add_binary("1111".to_string(), "1111".to_string()), "11110"); + assert_eq!( + add_binary( + "10110101010001101011001011100011\ +10100111101001010011000011000100\ +11110111001001111010110000000010\ +11100100110010110111101001100010\ +10000101100010101010000111100100\ +10100110010010100110111010011001\ +11110111011101010000000110101001\ +10000101110010101101011011011000" + .to_string(), + "11101111111010110101001000000110\ +10010101100011001110011100101111\ +10011111011100000010100111010100\ +11101111111010111010011111001011\ +00000001001010111100100000010010\ +10110001010101011100001100000010\ +11010000010010011101100000000111\ +10000100111011110110000001110100" + .to_string() + ), + "11010010100110010000001001110101\ +00011110100110010000101111111010\ +01001011010010111110101011101011\ +11101010010110111001000100010110\ +11000011010110110011010011111011\ +10101011110100000001100011001110\ +01100011110111110110110011011000\ +10000101010111010001101110100110\ +0" + ); }