manual tests ok, vars corrected

This commit is contained in:
Louis Rubet 2022-02-20 19:07:55 +01:00
parent 4aa71db351
commit 12b83f69af
5 changed files with 29 additions and 46 deletions

View file

@ -193,18 +193,18 @@ void program::rpn_vars(void) {
// heap variables
for (int i = 0; i < (int)_heap->size(); i++) {
(void)_heap->get_by_index(i, name, obj);
printf("var %d: name '%s', type %s, value ", i + 1, name.c_str(), obj->name());
cout<<"var "<<i+1<<": name '"<<name<<"', type "<<obj->name()<<", value ";
obj->show(cout);
printf("\n");
cout<<endl;
}
// parents local variables
while (parent != NULL) {
for (int i = 0; i < (int)parent->_local_heap.size(); i++) {
(void)parent->_local_heap.get_by_index(i, name, obj);
printf("local var %d: name '%s', type %s, value ", i + 1, name.c_str(), obj->name());
cout<<"var "<<i+1<<": name '"<<name<<"', type "<<obj->name()<<", value ";
obj->show(cout);
printf("\n");
cout<<endl;
}
parent = parent->_parent_prog;
}
@ -212,9 +212,9 @@ void program::rpn_vars(void) {
// local variables
for (int i = 0; i < (int)_local_heap.size(); i++) {
(void)_local_heap.get_by_index(i, name, obj);
printf("local var %d: name '%s', type %s, value ", i + 1, name.c_str(), obj->name());
cout<<"var "<<i+1<<": name '"<<name<<"', type "<<obj->name()<<", value ";
obj->show(cout);
printf("\n");
cout<<endl;
}
}

View file

@ -115,6 +115,7 @@ class heap : public map<string, object*> {
for (; num > 0; num--, i++)
;
obj = i->second;
name = i->first;
return true;
} else
return false;

View file

@ -39,3 +39,21 @@
-> error should be 0
`del`
## quit
`q`
-> error should be 8
## quit (2)
`quit`
-> error should be 8
## exit
`exit`
-> error should be 8

View file

@ -2,54 +2,20 @@
`default del`
## GENERAL help - please type help and verify help is shown
## GENERAL help - please type help, h or ? and verify help is shown
-> error should be 0
`del`
## GENERAL h - please type h and verify help is shown
-> error should be 0
`del`
## GENERAL ? - please type ? and verify help is shown
-> error should be 0
`del`
## GENERAL quit - please type quit and verify rpn exits
-> error should be 0
`del`
## GENERAL q - please type q and verify rpn exits
-> error should be 0
del
## GENERAL exit - please type exit and verify rpn exits
`-> error should be 0`
del
## STORE vars - please type vars and verify variables are shown
`-> error should be 0`
`vars`
del
-> error should be 0
## STORE edit - please type edit and verify last line comes under the caret
-> error should be 0
`del`
## HISTORY - please type history and verify rpn history is shown
-> error should be 0
@ -57,5 +23,3 @@ del
## MULTILINE EDITING - please type a prog like 1 3 for i[ALT-ENTER]i sq[ALT-ENTER]next[ENTER] and verify output
-> error should be 0
`del`

View file

@ -21,4 +21,4 @@
@include 110-time.md
@include 120-trig.md
@include 130-logs.md
# @include 999-manual-tests.md
@include 999-manual-tests.md