Annotation of researchv10no/cmd/cfront/libstring/test6.c, revision 1.1.1.1

1.1       root        1: // list test program.  exercise subscripts. test ==
                      2: 
                      3: #include "String.h"
                      4: #include "list.h"
                      5: 
                      6: listdeclare(String)
                      7: listdeclare(int)
                      8: listimplement(int)
                      9: listoutimplement(int)
                     10: 
                     11: main()
                     12: {
                     13:        String_list     slist;
                     14:        int_list        ilist;
                     15:        slist.put("zero").put("one").put("two").put("three").put("four");
                     16:        ilist.put((int)0).put(1).put(2).put(3).put(4);
                     17:        cout << slist << "\n" << ilist << "\n";
                     18:        String_list     slist1 = slist;
                     19:        int_list        ilist1;
                     20:        ilist1 = ilist;
                     21:        cout << slist[2] << " should be \"two\"\n";
                     22:        slist[2] = "not two";
                     23:        cout << slist[2] << " should not be \"two\"\n";
                     24:        cout << slist1[2] << " should be \"two\"\n";
                     25:        ilist1[2] = -2;
                     26:        cout << int(ilist[2]) << " should be 2\n";
                     27:        cout << int(ilist1[2]) << " should be -2\n";
                     28:        cout << (slist == slist1) << " should be 0\n";
                     29:        cout << (ilist == ilist1) << " should be 0\n";
                     30:        slist[2] = "two";
                     31:        ilist[2] = -2;
                     32:        cout << (slist == slist1) << " should be 1\n";
                     33:        cout << (ilist == ilist1) << " should be 1\n";
                     34: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.