cleaning up tests

This commit is contained in:
2022-09-06 09:22:50 +01:00
parent b8f20add66
commit 17f1dc8647
10 changed files with 116 additions and 36 deletions

View File

@@ -41,7 +41,6 @@ int _index(Interpreter* interpreter, LiteralArray* arguments) {
if (IS_DICTIONARY(compound)) {
value = getLiteralDictionary(AS_DICTIONARY(compound), first);
//dictionary
//dictionary
if (IS_NULL(op)) {
pushLiteralArray(&interpreter->stack, value);
@@ -525,6 +524,8 @@ int _index(Interpreter* interpreter, LiteralArray* arguments) {
for (int i = AS_INTEGER(second) + 1; i < strlen(AS_STRING(compound)); i++) {
result[ resultIndex++ ] = AS_STRING(compound)[ i ];
}
result[ resultIndex++ ] = '\0';
}
//else override elements of the array instead
@@ -532,7 +533,7 @@ int _index(Interpreter* interpreter, LiteralArray* arguments) {
//copy compound to result
snprintf(result, MAX_STRING_LENGTH, AS_STRING(compound));
int min = AS_INTEGER(third) > 0 ? AS_INTEGER(first) : AS_INTEGER(second);
int min = AS_INTEGER(third) > 0 ? AS_INTEGER(first) : AS_INTEGER(second) - 1;
int assignIndex = 0;
for (int i = min; i >= AS_INTEGER(first) && i <= AS_INTEGER(second) && assignIndex < strlen(AS_STRING(assign)); i += AS_INTEGER(third)) {