Skip to content

Commit

Permalink
Fix DeleteVariantAttribute bug in cases where there are no attributes…
Browse files Browse the repository at this point in the history
… to delete (#615)

* report found as false when there are no attributes and name is empty/unwired in deletevariantattributes

* add more test and fix broken test

* rename test

* update tests
  • Loading branch information
siddhukrs authored and sanmut committed May 14, 2019
1 parent 9cdee8e commit b4629dc
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 3 deletions.
2 changes: 0 additions & 2 deletions source/core/Variants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ VIREO_FUNCTION_SIGNATURET(DeleteVariantAttribute, DeleteVariantAttributeParamBlo
}
}
}
} else if (clearAllAttributes) {
found = true;
}
}
if (_ParamPointer(Found))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TestResult_EmptyVariantConstantWithNameUnwired true
TestResult_EmptyVariantConstantWithNameEmpty true
TestResult_VariantWithDataWithNameUnwired true
TestResult_VariantWithDataWithNameEmpty true
2 changes: 1 addition & 1 deletion test-it/ViaTests/TestVI_VariantDeleteAttributes.via
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ define (Application%3A%3ATestVI_VariantDeleteAttributes%2Egviweb dv(.VirtualInst
ce(dv(.Boolean true)c146)
ce(dv(.ErrorCluster (false 0 '' ))c147)
e(.Boolean local148)
ce(dv(.Boolean true)c149)
ce(dv(.Boolean false)c149)
e(.Boolean local150)
ce(dv(.String 'VARIANT')c151)
ce(dv(.Int32 0)c152)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Autogenerated Vireo assembly file
// Generated on 05/10/2019 11:55:20
//---------------------------------------------------
//VI Definition: ::Web Server::Interactive::Application::DeleteVariantAttributeWithNoName_DeletesAllAttributesAndReturnsFalse.gviweb
define (Application%3A%3ADeleteVariantAttributeWithNoName_DeletesAllAttributesAndReturnsFalse%2Egviweb dv(.VirtualInstrument (
Locals: c( // Data Space
e(dv(.String 'Application::DeleteVariantAttributeWithNoName_DeletesAllAttributesAndReturnsFalse.gviweb')local0)
ce(dv(.Variant )c1)
ce(dv(.ErrorCluster (false 0 '' ))c2)
e(.ErrorCluster local3)
e(.Boolean local4)
e(.Variant local5)
e(.Boolean local6)
e(.Boolean local7)
e(dv(.Boolean false)dataItem_TestResult_EmptyVariantConstantWithNameUnwired)
e(.Boolean local9)
ce(dv(.ErrorCluster (false 0 '' ))c10)
ce(dv(.Int32 32)c11)
e(.Variant local12)
e(.ErrorCluster local13)
e(.Boolean local14)
e(.Variant local15)
e(.Boolean local16)
e(.Boolean local17)
e(dv(.Boolean false)dataItem_TestResult_VariantWithDataWithNameUnwired)
e(.Boolean local19)
ce(dv(.Variant )c20)
ce(dv(.ErrorCluster (false 0 '' ))c21)
ce(dv(.ErrorCluster (false 0 '' ))c22)
ce(dv(.Int32 32)c23)
e(.Variant local24)
ce(dv(.String '')c25)
e(.ErrorCluster local26)
e(.Boolean local27)
e(.Variant local28)
e(.Boolean local29)
e(.Boolean local30)
e(dv(.Boolean false)dataItem_TestResult_EmptyVariantConstantWithNameEmpty)
e(.Boolean local32)
ce(dv(.String '')c33)
e(.ErrorCluster local34)
e(.Boolean local35)
e(.Variant local36)
e(.Boolean local37)
e(.Boolean local38)
e(dv(.Boolean false)dataItem_TestResult_VariantWithDataWithNameEmpty)
e(.Boolean local40)
e(.Boolean local41)
e(.Boolean local42)
e(.Boolean local43)
e(.Boolean local44)
)
clump(1
Copy(c1 local5)
Copy(c2 local3)
DeleteVariantAttribute(local5 * local4 local3)
IsEQ(local3 c2 local6)
Not(local4 local41 )
And(local41 local6 local7)
Copy(local7 dataItem_TestResult_EmptyVariantConstantWithNameUnwired)
DataToVariant(c11 local12)
Copy(c10 local13)
DeleteVariantAttribute(local12 * local14 local13)
IsEQ(local13 c10 local16)
Not(local14 local42 )
And(local42 local16 local17)
Copy(local17 dataItem_TestResult_VariantWithDataWithNameUnwired)
DataToVariant(c23 local24)
Copy(c20 local28)
Copy(c21 local26)
DeleteVariantAttribute(local28 c25 local27 local26)
IsEQ(local26 c21 local29)
Not(local27 local43 )
And(local43 local29 local30)
Copy(local30 dataItem_TestResult_EmptyVariantConstantWithNameEmpty)
Copy(c22 local34)
DeleteVariantAttribute(local24 c33 local35 local34)
IsEQ(local34 c22 local37)
Not(local35 local44 )
And(local44 local37 local38)
Copy(local38 dataItem_TestResult_VariantWithDataWithNameEmpty)
Printf("TestResult_EmptyVariantConstantWithNameUnwired %z\n" dataItem_TestResult_EmptyVariantConstantWithNameUnwired)
Printf("TestResult_EmptyVariantConstantWithNameEmpty %z\n" dataItem_TestResult_EmptyVariantConstantWithNameEmpty)
Printf("TestResult_VariantWithDataWithNameUnwired %z\n" dataItem_TestResult_VariantWithDataWithNameUnwired)
Printf("TestResult_VariantWithDataWithNameEmpty %z\n" dataItem_TestResult_VariantWithDataWithNameEmpty)
/* Clump Ended. */ )
)))
enqueue (Application%3A%3ADeleteVariantAttributeWithNoName_DeletesAllAttributesAndReturnsFalse%2Egviweb)
//Finished!! :D
1 change: 1 addition & 0 deletions test-it/testList.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
"VariantCopy.via",
"VariantDataConversion.via",
"VariantToData_EmptyVariantConstantAsInput_ReportsError.via",
"VariantWithNoAttributes_DeleteVariantAttributeWithNameUnspecified_ReturnsFoundAsFalse.via",
"V3.via",
"VectorOps.via",
"VectorReduce.via",
Expand Down

0 comments on commit b4629dc

Please sign in to comment.