History

added a test routine for testing insertIntoSortedArrays()

ZappoMan committed 13 years ago

Commit 732b4871 parent 0c692ca1 file · +27 −0Browse files

Showing the changes to interface/src/main.cpp (1 of 1 file). Show all

Unified · Split

interface/src/main.cpp+27−0
@@ -1634,6 +1634,33 @@ int main(int argc, const char * argv[]) · 1633 unmodified lines
16341634 return EXIT_SUCCESS;
16351635 }
16361636
1637+ // Quick test of sortedArrays helper
1638+ if (cmdOptionExists(argc, argv, "--testSortedArray")) {
1639+ void* values[8];
1640+ float keys[8];
1641+ int meta[8];
1642+ int count = 0;
1643+
1644+ count = insertIntoSortedArrays((void*)10, 10.0, 1, values, keys, meta, count, 8);
1645+ printf("after one insert...\n");
1646+ for (int i=0; i<count; i++){
1647+ printf("keys[%d]=%f values[%d]=%ld meta[%d]=%d\n",i,keys[i],i,(long)values[i],i,meta[i]);
1648+ }
1649+
1650+ count = insertIntoSortedArrays((void*)20, 100.0, 2, values, keys, meta, count, 8);
1651+ printf("after two insert...\n");
1652+ for (int i=0; i<count; i++){
1653+ printf("keys[%d]=%f values[%d]=%ld meta[%d]=%d\n",i,keys[i],i,(long)values[i],i,meta[i]);
1654+ }
1655+
1656+ count = insertIntoSortedArrays((void*)30, 1.0, 3, values, keys, meta, count, 8);
1657+ printf("after three inserts...\n");
1658+ for (int i=0; i<count; i++){
1659+ printf("keys[%d]=%f values[%d]=%ld meta[%d]=%d\n",i,keys[i],i,(long)values[i],i,meta[i]);
1660+ }
1661+ return EXIT_SUCCESS;
1662+ }
1663+
16371664 AgentList::createInstance(AGENT_TYPE_AVATAR);
16381665
16391666 gettimeofday(&applicationStartupTime, NULL);