Showing the changes to interface/src/main.cpp (1 of 1 file). Show all
Unified · Split
| @@ -1634,6 +1634,33 @@ int main(int argc, const char * argv[]) · 1633 unmodified lines | ||
| 1634 | 1634 | return EXIT_SUCCESS; |
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 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 | + | |
| 1637 | 1664 | AgentList::createInstance(AGENT_TYPE_AVATAR); |
| 1638 | 1665 | |
| 1639 | 1666 | gettimeofday(&applicationStartupTime, NULL); |