ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/gtest.cpp
(Generate patch)
# Line 2 | Line 2
2   #include "GArgs.h"
3   #include "GStr.h"
4   #include "GBitVec.h"
5 + #include "GList.hh"
6 + #include "GHash.hh"
7  
8   #define USAGE "Usage:\n\
9   gtest [--bit-test|-g|--genomic-fasta <genomic_seqs_fasta>] [-c|COV=<cov%>] \n\
# Line 37 | Line 39
39   GError("Error bit checking (index %d)!\n", idx);
40   }
41  
42 + struct Gint {
43 +  int v;
44 +  Gint(int vv=0):v(vv) {}
45 +  int val() { return v; }
46 +  ~Gint() {
47 +  GMessage("Gint with val %d getting destroyed\n", v);
48 +  }
49 + };
50 +
51 + int cmpGint(pointer p1, pointer p2) {
52 + int v1=((Gint*)p1)->v;
53 + int v2=((Gint*)p2)->v;
54 + if (v1<v2) return -1;
55 + return (v1>v2)? 1 : 0;
56 + }
57 +
58 + void testGPVec() {
59 + GPVec<Gint> vecs[3];
60 + vecs[1].Add(new Gint(2));
61 + vecs[2].Add(new Gint(3));
62 + GMessage("Added to vecs[1]:%d\n", vecs[1][0]->val());
63 + GMessage("Added to vecs[2]:%d\n", vecs[2][0]->val());
64 + }
65  
66   int main(int argc, char * const argv[]) {
67   //GArgs args(argc, argv, "hg:c:s:t:o:p:help;genomic-fasta=COV=PID=seq=out=disable-flag;test=");
# Line 50 | Line 75
75       GMessage("%s\n", USAGE);
76       exit(1);
77       }
78 + //---
79 + GHash<GVec<int> > ends;
80 +
81 + /*
82 + testGPVec();
83 + //exit(0);
84 +
85 + //uint pos=3;
86 + //GStr spos((int)pos);
87 + //GVec<int> *ev=ends[spos.chars()];
88 +
89 + GPVec<Gint> v;
90 + int r(5);
91 + int rr=v.Add(new Gint(3));
92 + //if (rr<0) {
93 + // GMessage("Error adding 0! (code %d)\n",rr);
94 + // }
95 + v.Add(new Gint(r));
96 + v.Add(new Gint(2));
97 + v.Add(new Gint(1));
98 + v.Add(new Gint(4));
99 + rr=v.Add(new Gint(0));
100 + v[rr]->v=-1;
101 + v.Sort(cmpGint);
102 + GMessage("collection has %d elements:\n",v.Count());
103 + for (int i=0;i<v.Count();i++) {
104 +   GMessage("v[%d]=%d;\n",i,v[i]->v);
105 + }
106 + exit(0);
107 + */
108 + //---
109 +
110   int numopts=args.startOpt();
111   if (numopts)
112     GMessage("#### Recognized %d option arguments:\n", numopts);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines