aboutsummaryrefslogtreecommitdiffstats
path: root/lv2/lv2plug.in/ns/ext/atom/atom-test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-23 01:53:15 +0000
committerDavid Robillard <d@drobilla.net>2012-02-23 01:53:15 +0000
commitc2cc2607f8d5b9eea933a18abd91b2ce708fc90c (patch)
tree9923ca1257024897eccad5aae61c74cd37ce6609 /lv2/lv2plug.in/ns/ext/atom/atom-test.c
parentc69ce6e891824fc64022a3615542fc30edc89cd7 (diff)
downloadlv2-c2cc2607f8d5b9eea933a18abd91b2ce708fc90c.tar.xz
Separately define body types for atoms with non-trivial bodies so the type definitions are useful when only the body is available (e.g. state API).
Use a single int64_t stamp for frame times since range is more important now and subframes was never really used anyway. Add atom:frameTime and atom:beatTime for serialising events. Consistently use name "body" for all types of atom bodies. Add lv2_atom_forge_atom() and lv2_atom_forge_raw() for constructing arbitrary atoms. Merge similar string-like forge methods. Update language URI requirements to match current (and hopefully permanent, geeze) http://lexvo.org reality.
Diffstat (limited to 'lv2/lv2plug.in/ns/ext/atom/atom-test.c')
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/atom-test.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-test.c b/lv2/lv2plug.in/ns/ext/atom/atom-test.c
index 8e56c79..7e90c15 100644
--- a/lv2/lv2plug.in/ns/ext/atom/atom-test.c
+++ b/lv2/lv2plug.in/ns/ext/atom/atom-test.c
@@ -94,43 +94,43 @@ main()
// eg_one = (Int32)1
lv2_atom_forge_property_head(&forge, eg_one, 0);
LV2_Atom_Int32* one = lv2_atom_forge_int32(&forge, 1);
- if (one->value != 1) {
- return test_fail("%d != 1\n", one->value);
+ if (one->body != 1) {
+ return test_fail("%d != 1\n", one->body);
}
// eg_two = (Int64)2
lv2_atom_forge_property_head(&forge, eg_two, 0);
LV2_Atom_Int64* two = lv2_atom_forge_int64(&forge, 2);
- if (two->value != 2) {
- return test_fail("%ld != 2\n", two->value);
+ if (two->body != 2) {
+ return test_fail("%ld != 2\n", two->body);
}
// eg_three = (Float)3.0
lv2_atom_forge_property_head(&forge, eg_three, 0);
LV2_Atom_Float* three = lv2_atom_forge_float(&forge, 3.0f);
- if (three->value != 3) {
- return test_fail("%f != 3\n", three->value);
+ if (three->body != 3) {
+ return test_fail("%f != 3\n", three->body);
}
// eg_four = (Double)4.0
lv2_atom_forge_property_head(&forge, eg_four, 0);
LV2_Atom_Double* four = lv2_atom_forge_double(&forge, 4.0);
- if (four->value != 4) {
- return test_fail("%ld != 4\n", four->value);
+ if (four->body != 4) {
+ return test_fail("%ld != 4\n", four->body);
}
// eg_true = (Bool)1
lv2_atom_forge_property_head(&forge, eg_true, 0);
LV2_Atom_Bool* t = lv2_atom_forge_bool(&forge, true);
- if (t->value != 1) {
- return test_fail("%ld != 1 (true)\n", t->value);
+ if (t->body != 1) {
+ return test_fail("%ld != 1 (true)\n", t->body);
}
// eg_false = (Bool)0
lv2_atom_forge_property_head(&forge, eg_false, 0);
LV2_Atom_Bool* f = lv2_atom_forge_bool(&forge, false);
- if (f->value != 0) {
- return test_fail("%ld != 0 (false)\n", f->value);
+ if (f->body != 0) {
+ return test_fail("%ld != 0 (false)\n", f->body);
}
// eg_path = (Path)"/foo/bar"
@@ -159,8 +159,8 @@ main()
LV2_URID eg_value = urid_map(NULL, "http://example.org/value");
lv2_atom_forge_property_head(&forge, eg_urid, 0);
LV2_Atom_URID* urid = lv2_atom_forge_urid(&forge, eg_value);
- if (urid->id != eg_value) {
- return test_fail("%u != %u\n", urid->id, eg_value);
+ if (urid->body != eg_value) {
+ return test_fail("%u != %u\n", urid->body, eg_value);
}
// eg_string = (String)"hello"
@@ -226,9 +226,9 @@ main()
lv2_atom_forge_property_head(&forge, eg_seq, 0);
LV2_Atom_Forge_Frame seq_frame;
LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)lv2_atom_forge_sequence_head(&forge, &seq_frame, 0);
- lv2_atom_forge_audio_time(&forge, 0, 0);
+ lv2_atom_forge_frame_time(&forge, 0);
lv2_atom_forge_int32(&forge, 1);
- lv2_atom_forge_audio_time(&forge, 1, 0);
+ lv2_atom_forge_frame_time(&forge, 1);
lv2_atom_forge_int32(&forge, 2);
lv2_atom_forge_pop(&forge, &seq_frame);
@@ -240,17 +240,18 @@ main()
return test_fail("1 == 2.0\n");
} else if (lv2_atom_equals((LV2_Atom*)one, (LV2_Atom*)&itwo)) {
return test_fail("1 == 2\n");
+ } else if (!lv2_atom_equals((LV2_Atom*)one, (LV2_Atom*)one)) {
+ return test_fail("1 != 1\n");
}
unsigned n_events = 0;
LV2_SEQUENCE_FOREACH(seq, i) {
LV2_Atom_Event* ev = lv2_sequence_iter_get(i);
- if (ev->time.audio.frames != n_events
- || ev->time.audio.subframes != 0) {
+ if (ev->time.frames != n_events) {
return test_fail("Corrupt event %u has bad time\n", n_events);
} else if (ev->body.type != forge.Int32) {
return test_fail("Corrupt event %u has bad type\n", n_events);
- } else if (((LV2_Atom_Int32*)&ev->body)->value != (int)n_events + 1) {
+ } else if (((LV2_Atom_Int32*)&ev->body)->body != (int)n_events + 1) {
return test_fail("Event %u != %d\n", n_events, n_events + 1);
}
++n_events;