Skip to content

Commit

Permalink
NODE-2598 Added RIDE test ids (#3856)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kseolis authored Jul 18, 2023
1 parent ee95b92 commit 9466846
Show file tree
Hide file tree
Showing 103 changed files with 312 additions and 327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object NegativeTestsOfUnsupportedMethods extends JsTestBase {
private val min = "min(callerTestData)"

val tests: Tests = Tests {
test("toBigInt functions compilation error: Undefined type: `BigInt` for ride v3, v4") {
test("RIDE-280. toBigInt function should throw a compilation error for RIDE versions V3 and V4.") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("BigInt", version)
for (
Expand All @@ -52,15 +52,15 @@ object NegativeTestsOfUnsupportedMethods extends JsTestBase {
}
}

test("compilation error: invalid data invoke for ride v3, v4 (argument before function)") {
test("RIDE-281. compilation error 'invalid data invoke' should occur for RIDE versions V3 and V4 when an argument is placed before the function.") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
val script = precondition.codeForDAppInvocation(randomByteVectorArrayElement, randomAddressDataArrayElement, invokeArgBeforeFunc)
assertCompileErrorDApp(script, version, CANT_FIND_FUNCTION)
}
}

test("compilation error: blake2b256 functions Can't find a function for V3") {
test("RIDE-282. blake2b256 functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("ByteVector", V3)
for (
(data, function, error) <- Seq(
Expand All @@ -75,7 +75,7 @@ object NegativeTestsOfUnsupportedMethods extends JsTestBase {
}
}

test("compilation error: keccak256 Can't find a functions for V3") {
test("RIDE-283. keccak256 functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("ByteVector", V3)
for (
(data, function, error) <- Seq(
Expand All @@ -90,20 +90,34 @@ object NegativeTestsOfUnsupportedMethods extends JsTestBase {
}
}

test("Can't find a functions for V3") {
test("RIDE-284. containsElement functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("", V3)
for (
(data, list, function) <- Seq(
(randomStringArrayElement, stringList, containsElement),
(randomInt.toString, intList, indexOf),
(randomInt.toString, intList, max),
(randomInt.toString, intList, min),
(randomInt.toString, intList, removeByIndex)
)
) {
val script = precondition.simpleRideCode(data, list, function)
assertCompileErrorDApp(script, V3, CANT_FIND_FUNCTION)
}
val script = precondition.simpleRideCode(randomStringArrayElement, stringList, containsElement)
assertCompileErrorDApp(script, V3, CANT_FIND_FUNCTION)
}

test("RIDE-285. indexOf functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("", V3)
val script = precondition.simpleRideCode(randomInt.toString, intList, indexOf)
assertCompileErrorDApp(script, V3, CANT_FIND_FUNCTION)
}

test("RIDE-286. max functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("", V3)
val script = precondition.simpleRideCode(randomInt.toString, intList, max)
assertCompileErrorDApp(script, V3, CANT_FIND_FUNCTION)
}

test("RIDE-287. min functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("", V3)
val script = precondition.simpleRideCode(randomInt.toString, intList, min)
assertCompileErrorDApp(script, V3, CANT_FIND_FUNCTION)
}

test("RIDE-288. removeByIndex functions should throw an error for RIDE version V3.") {
val precondition = new GeneratorContractsForBuiltInFunctions("", V3)
val script = precondition.simpleRideCode(randomInt.toString, intList, removeByIndex)
assertCompileErrorDApp(script, V3, CANT_FIND_FUNCTION)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object GetBinary extends JsTestBase {
private val invalidGetBinaryValue = s"getBinaryValue(callerTestData)"

val tests: Tests = Tests {
test("functions getBinary accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-4. Compile getBinary functions for address, alias, and 'this'") {
for (version <- testData.actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("ByteVector", version)
for (
Expand All @@ -48,7 +48,7 @@ object GetBinary extends JsTestBase {
}
}

test("functions own data getBinary accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-5. Compile own data getBinary functions for address, alias, and 'this'") {
for (version <- testData.versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("ByteVector", version)
for (ownData <- Seq(ownDataGetBinary, ownDataGetBinaryArgBeforeFunc, ownDataGetBinaryValueArgBeforeFunc, ownDataGetBinaryValue)) {
Expand All @@ -58,7 +58,7 @@ object GetBinary extends JsTestBase {
}
}

test("negative tests for getBinary functions") {
test("RIDE-6. Test negative scenarios for getBinary functions") {
val invalidFunction = s"getBinaryValue($randomInt)"
val invalidArgBeforeFunction = s"$randomInt.getBinaryValue()"
for (version <- testData.actualVersions) {
Expand All @@ -79,8 +79,7 @@ object GetBinary extends JsTestBase {
}
}


test("Can't find a own data functions overload Binary accountDataStorage for old Versions") {
test("RIDE-7. Ensure no overload of own data Binary accountDataStorage for old versions") {
for (version <- testData.oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("ByteVector", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object GetBoolean extends JsTestBase {
private val invalidGetBooleanValue = s"getBooleanValue(callerTestData)"

val tests: Tests = Tests {
test("functions getBoolean accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-8. Compile getBoolean functions for address, alias, and 'this'") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (
Expand All @@ -48,7 +48,7 @@ object GetBoolean extends JsTestBase {
}
}

test("functions own data getBoolean accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-9. Compile own data getBoolean functions for address, alias, and 'this'") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (ownData <- Seq(ownDataGetBoolean, ownDataGetBooleanArgBeforeFunc, ownDataGetBooleanValueArgBeforeFunc, ownDataGetBooleanValue)) {
Expand All @@ -58,7 +58,7 @@ object GetBoolean extends JsTestBase {
}
}

test("negative tests for getBoolean functions") {
test("RIDE-10. Negative tests for getBoolean functions") {
val invalidFunction = s"getBooleanValue($randomInt)"
val invalidArgBeforeFunction = s"$randomInt.getBooleanValue()"
for (version <- actualVersions) {
Expand All @@ -79,7 +79,7 @@ object GetBoolean extends JsTestBase {
}
}

test("Can't find a own data functions overload Boolean accountDataStorage for old Versions") {
test("RIDE-11. Ensure no overload of own data Boolean accountDataStorage for old Versions") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object GetInteger extends JsTestBase {
private val invalidGetIntValue = s"getIntegerValue(callerTestData)"

val tests: Tests = Tests {
test("functions getInteger accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-12. Compile getInteger functions for address, alias, and 'this'") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Int", version)
for (
Expand All @@ -48,7 +48,7 @@ object GetInteger extends JsTestBase {
}
}

test("functions own data getInteger accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-13. Compile own data getInteger functions for address, alias, and 'this'") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("Int", version)
for (ownData <- Seq(ownDataGetInt, ownDataGetIntArgBeforeFunc, ownDataGetIntValueArgBeforeFunc, ownDataGetIntValue)) {
Expand All @@ -58,7 +58,7 @@ object GetInteger extends JsTestBase {
}
}

test("negative tests for getInteger functions") {
test("RIDE-14. Test negative scenarios for getInteger functions") {
val invalidFunction = s"getIntegerValue($randomInt)"
val invalidArgBeforeFunction = s"$randomInt.getIntegerValue()"
for (version <- actualVersions) {
Expand All @@ -79,7 +79,7 @@ object GetInteger extends JsTestBase {
}
}

test("Can't find a own data functions overload Integer accountDataStorage for old Versions") {
test("RIDE-15. Ensure no overload of own data Integer accountDataStorage for old versions") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Int", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object GetString extends JsTestBase {
private val invalidGetStringValue = s"getStringValue(callerTestData)"

val tests: Tests = Tests {
test("functions getString accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-16. Compile getString functions for address, alias, and 'this'") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("String", version)
for (
Expand All @@ -48,7 +48,7 @@ object GetString extends JsTestBase {
}
}

test("functions own data getString accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-17. Compile own data getString functions for address, alias, and 'this'") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("String", version)
for (ownData <- Seq(ownDataGetString, ownDataGetStringArgBeforeFunc, ownDataGetStringValueArgBeforeFunc, ownDataGetStringValue)) {
Expand All @@ -58,7 +58,7 @@ object GetString extends JsTestBase {
}
}

test("negative tests for getString functions") {
test("RIDE-18. Test negative scenarios for getString functions") {
val invalidFunction = s"getStringValue($randomInt)"
val invalidArgBeforeFunction = s"$randomInt.getStringValue()"
for (version <- actualVersions) {
Expand All @@ -79,7 +79,7 @@ object GetString extends JsTestBase {
}
}

test("Can't find a own data functions overload String accountDataStorage for old Versions") {
test("RIDE-19. Ensure no overload of own data Integer accountDataStorage for old versions") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("String", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object IsDataStorageUntouched extends JsTestBase {
private val invalidFunctionErrorResult: String = invalidFunctionError("isDataStorageUntouched", 1)

val tests: Tests = Tests {
test("functions IsDataStorageUntouched accountDataStorage compiles for address, alias and 'this'") {
test("RIDE-20. Compile isDataStorageUntouched functions for address, alias, and 'this'") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (
Expand All @@ -40,7 +40,7 @@ object IsDataStorageUntouched extends JsTestBase {
}
}

test("Non-matching types for function is DataStorageUntouched") {
test("RIDE-21. Non-matching types for function isDataStorageUntouched") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (
Expand All @@ -55,7 +55,7 @@ object IsDataStorageUntouched extends JsTestBase {
}
}

test("Invalid data for functions isDataStorageUntouched") {
test("RIDE-22. Invalid data for functions isDataStorageUntouched") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (
Expand All @@ -71,7 +71,7 @@ object IsDataStorageUntouched extends JsTestBase {
}
}

test("Can't find functions isDataStorageUntouched dataStorage accountDataStorage for old Versions") {
test("RIDE-23. Can't find functions isDataStorageUntouched dataStorage accountDataStorage for old Versions") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Boolean", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object AddressFromRecipient extends JsTestBase {
private val invalidFunc = "addressFromRecipient()"

val tests: Tests = Tests {
test("functions addressFromRecipient compiles for address, alias and 'this'") {
test("RIDE-24. Compile addressFromRecipient function for address, alias, and 'this'") {
for (version <- testData.actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -31,7 +31,7 @@ object AddressFromRecipient extends JsTestBase {
}
}

test("addressFromRecipient Non-matching types: expected: Address|Alias") {
test("RIDE-25. Invalid data for functions addressFromRecipient") {
for (version <- testData.actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -46,7 +46,7 @@ object AddressFromRecipient extends JsTestBase {
}
}

test("Function 'addressFromRecipient' requires 1 arguments") {
test("RIDE-26. Function 'addressFromRecipient' requires 1 arguments") {
for (version <- testData.actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
val script = precondition.codeForAddressFromRecipient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object AssetBalance extends JsTestBase {
private val invalidAssetBalanceFunc = "assetBalance()"

val tests: Tests = Tests {
test("Functions assetBalance compiles for address, alias and 'this'") {
test("RIDE-27. Compile assetBalance function for address, alias, and 'this'") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -35,7 +35,7 @@ object AssetBalance extends JsTestBase {
}
}

test("negative cases") {
test("RIDE-28. Invalid data must be validated") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object AssetInfo extends JsTestBase {


val tests: Tests = Tests {
test("Functions assetInfo compiles") {
test("RIDE-30. Compile assetInfo function for asset") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Asset", version)
for (
Expand All @@ -31,7 +31,7 @@ object AssetInfo extends JsTestBase {
}
}

test("negative cases") {
test("RIDE-29. Invalid data must be validated") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("Asset", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object BlockInfoByHeight extends JsTestBase {
private val invalidBlockInfoByHeight = "blockInfoByHeight()"

val tests: Tests = Tests {
test("Functions blockInfoByHeight compiles") {
test("RIDE-31. BlockInfoByHeight function should compile") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("BlockInfo", version)
for (
Expand All @@ -28,7 +28,7 @@ object BlockInfoByHeight extends JsTestBase {
}
}

test("negative cases blockInfoByHeight") {
test("RIDE-32. Negative cases for blockInfoByHeight function when invalid arguments are passed") {
for (version <- actualVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("BlockInfo", version)
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object CalculateAssetId extends JsTestBase {
private val invalidCalculateAssetId = "calculateAssetId()"

val tests: Tests = Tests {
test("Functions CalculateAssetId for version V4 and more compiled for Issue") {
test("RIDE-33. CalculateAssetId function should compile for version V4 and higher when called for Issue operatio") {
for (version <- actualVersionsWithoutV3) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -28,7 +28,7 @@ object CalculateAssetId extends JsTestBase {
}
}

test("negative cases CalculateAssetId for version V4 and more") {
test("RIDE-34. Negative cases for CalculateAssetId function for version V4 and higher") {
for (version <- actualVersionsWithoutV3) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -44,7 +44,7 @@ object CalculateAssetId extends JsTestBase {
}
}

test("negative cases CalculateAssetId for version V3") {
test("RIDE-35. Negative cases for CalculateAssetId function for version V3") {
val precondition = new GeneratorContractsForBuiltInFunctions("", V3)
for (
(data, function) <- Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object CalculateLeaseId extends JsTestBase {
private val invalidCalculateLeaseId = "calculateLeaseId()"

val tests: Tests = Tests {
test("Functions calculateLeaseId for V5 and more compiles for address") {
test("RIDE-36. calculateLeaseId function should compile for version V5 and higher when called for an address") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -29,7 +29,7 @@ object CalculateLeaseId extends JsTestBase {
}
}

test("negative cases CalculateAssetId for version V5 and more") {
test("RIDE-37. Negative cases for calculateLeaseId function for version V5 and higher") {
for (version <- versionsSupportingTheNewFeatures) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand All @@ -46,7 +46,7 @@ object CalculateLeaseId extends JsTestBase {
}
}

test("negative cases CalculateAssetId for version V3, V4") {
test("RIDE-38. Negative cases for calculateLeaseId function for versions V3 and V4") {
for (version <- oldVersions) {
val precondition = new GeneratorContractsForBuiltInFunctions("", version)
for (
Expand Down
Loading

0 comments on commit 9466846

Please sign in to comment.