-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_test.cpp
75 lines (70 loc) · 2.05 KB
/
api_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "api.h"
int main(int, char**) {
FILTERS filters;
int offset=0, limit=99999999;
int bits_out[BITMAP_MAX_NWORDS];
BITMAP& bitmap_out = (BITMAP&)bits_out;
bitmap_out.clear(BITMAP_MAX_NWORDS);
set<int> set_out;
int result_type;
switch (0) {
case 0:
filters.instrument_ids.push_back(115); // piano
filters.instrument_ids.push_back(166); // violin
filters.period_ids.push_back(2);
filters.pub_year_min = 1700;
filters.pub_year_max = 1850;
filters.keywords.push_back("Mozart");
result_type = WORK_TYPE_ID;
break;
for (int i=0; i<100; i++) {
scan_works(
filters, result_type, offset, limit, bitmap_out, set_out
);
}
break;
case 1:
//filters.license_id = 35; // Creative commons
filters.license_id = 1; // Public Domain
filters.composer_sex = 2;
result_type = SCORE_ID;
for (int i=0; i<100; i++) {
scan_scores(
filters, result_type, offset, limit, bitmap_out, set_out
);
}
break;
case 2:
filters.license_id = 7; // Creative Commons Attribution-NonCommercial-NoDerivs 4.0
//filters.license_id = 1; // Public Domain
//filters.comp_sex = 2;
result_type = WORK_ID;
limit = 100;
for (int i=0; i<100; i++) {
scan_recordings(
filters, result_type, offset, limit, bitmap_out, set_out
);
}
break;
case 3:
COMBO_SPEC spec;
INST_COMBO ic;
int i=0;
ic.inst_id[i] = 1; ic.count[i] = 1;
i++;
ic.inst_id[i] = 3; ic.count[i] = 2;
i++;
ic.inst_id[i] = 5; ic.count[i] = 2;
i++;
ic.inst_id[i] = 0;
spec.add_inst(1,1,1);
spec.add_inst(3,1,5);
spec.others_ok = true;
if (spec.matches(ic)) {
printf("match\n");
} else {
printf("fail\n");
}
break;
}
}