From df2262712afbf58b13c72907a19270fee9f22e8e Mon Sep 17 00:00:00 2001 From: Gregoire Geis Date: Fri, 29 Sep 2017 23:20:59 +0200 Subject: [PATCH] Added tests for instruction cloning / copying. --- tests/test_values.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_values.rs b/tests/test_values.rs index c3f930c9ee539..7f7895a37c7b6 100644 --- a/tests/test_values.rs +++ b/tests/test_values.rs @@ -53,6 +53,17 @@ fn test_instructions() { assert_eq!(ptr.as_instruction().unwrap().get_opcode(), IntToPtr); assert_eq!(free_instruction.get_opcode(), Call); assert_eq!(return_instruction.get_opcode(), Return); + + // test instruction cloning + let instruction_clone = return_instruction.clone(); + + assert_eq!(instruction_clone.get_opcode(), return_instruction.get_opcode()); + assert_ne!(instruction_clone, return_instruction); + + // test copying + let instruction_clone_copy = instruction_clone; + + assert_eq!(instruction_clone, instruction_clone_copy); } #[test] @@ -693,4 +704,4 @@ fn test_value_copies() { let i8_value_copy = i8_value; assert_eq!(i8_value, i8_value_copy); -} \ No newline at end of file +}