about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-18 23:45:53 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-18 23:45:53 -0800
commit0c26f02d8156ccee727a71801b1d6b08984a1ff4 (patch)
tree19131a0d49334127253c88a0562c85bee29cb21f
parentc983ca9fb341f1b11435f2c31c17646ce016f875 (diff)
downloadmu-0c26f02d8156ccee727a71801b1d6b08984a1ff4.tar.gz
2672 - no, that test should be considered failing
Also exercise the breaking part in a couple of the unit tests for
replace_type_ingredient. Now we need to fix all three.
-rw-r--r--058shape_shifting_container.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/058shape_shifting_container.cc b/058shape_shifting_container.cc
index 70ca3172..890184d3 100644
--- a/058shape_shifting_container.cc
+++ b/058shape_shifting_container.cc
@@ -16,6 +16,7 @@ recipe main [
 +mem: storing 16 in location 5
 
 :(scenario size_of_shape_shifting_container_2)
+% Hide_errors = true;
 # multiple type ingredients
 container foo:_a:_b [
   x:_a
@@ -24,8 +25,10 @@ container foo:_a:_b [
 recipe main [
   1:foo:number:boolean <- merge 34, 1/true
 ]
+$error: 0
 
 :(scenario size_of_shape_shifting_container_3)
+% Hide_errors = true;
 container foo:_a:_b [
   x:_a
   y:_b
@@ -35,8 +38,10 @@ recipe main [
   # compound types for type ingredients
   {2: (foo number (address shared array character))} <- merge 34/x, 1:address:shared:array:character/y
 ]
+$error: 0
 
 :(scenario size_of_shape_shifting_container_4)
+% Hide_errors = true;
 container foo:_a:_b [
   x:_a
   y:_b
@@ -49,6 +54,7 @@ recipe main [
   1:address:shared:array:character <- new [abc]
   2:bar:number:array:character <- merge 34/x, 1:address:shared:array:character/y
 ]
+$error: 0
 
 :(before "End Globals")
 // We'll use large type ordinals to mean "the following type of the variable".
@@ -345,7 +351,11 @@ void test_replace_last_type_ingredient_with_multiple() {
       "  y:_b\n"
       "]\n");
   reagent callsite("{f: (foo number (address shared array character))}");
-  reagent element = element_type(callsite, 1);
+  reagent element = element_type(callsite, 0);
+  CHECK_EQ(element.name, "x");
+  CHECK_EQ(element.properties.at(0).second->value, "number");
+  CHECK(!element.properties.at(0).second->right);
+  element = element_type(callsite, 1);
   CHECK_EQ(element.name, "y");
   CHECK_EQ(element.properties.at(0).second->value, "address");
   CHECK_EQ(element.properties.at(0).second->right->value, "shared");
@@ -361,13 +371,21 @@ void test_replace_middle_type_ingredient_with_multiple() {
       "  z:_c\n"
       "]\n");
   reagent callsite("{f: (foo number (address shared array character) boolean)}");
-  reagent element = element_type(callsite, 1);
+  reagent element = element_type(callsite, 0);
+  CHECK_EQ(element.name, "x");
+  CHECK_EQ(element.properties.at(0).second->value, "number");
+  CHECK(!element.properties.at(0).second->right);
+  element = element_type(callsite, 1);
   CHECK_EQ(element.name, "y");
   CHECK_EQ(element.properties.at(0).second->value, "address");
   CHECK_EQ(element.properties.at(0).second->right->value, "shared");
   CHECK_EQ(element.properties.at(0).second->right->right->value, "array");
   CHECK_EQ(element.properties.at(0).second->right->right->right->value, "character");
   CHECK(!element.properties.at(0).second->right->right->right->right);
+  element = element_type(callsite, 2);
+  CHECK_EQ(element.name, "z");
+  CHECK_EQ(element.properties.at(0).second->value, "boolean");
+  CHECK(!element.properties.at(0).second->right);
 }
 
 const type_tree* nth_type(const type_tree* base, long long int n) {