aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-04-04 19:26:41 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-04-04 19:26:41 +0200
commitb6c55a8008f72a4ca87f6a6faabdb220c3bfce37 (patch)
tree873e1714242f0a130c792a4607ac26c32072c512
parentc5da4df6b414b29522b0ac206fb19efa60d80f66 (diff)
downloadprops.lv2-b6c55a8008f72a4ca87f6a6faabdb220c3bfce37.zip
props.lv2-b6c55a8008f72a4ca87f6a6faabdb220c3bfce37.tar.gz
props.lv2-b6c55a8008f72a4ca87f6a6faabdb220c3bfce37.tar.bz2
props.lv2-b6c55a8008f72a4ca87f6a6faabdb220c3bfce37.tar.xz
test: work on test_1.
-rw-r--r--VERSION2
-rw-r--r--test/props_test.c69
2 files changed, 41 insertions, 30 deletions
diff --git a/VERSION b/VERSION
index 841597f..025c316 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.119
+0.1.121
diff --git a/test/props_test.c b/test/props_test.c
index 3403a3b..3f409cc 100644
--- a/test/props_test.c
+++ b/test/props_test.c
@@ -15,16 +15,25 @@
* http://www.perlfoundation.org/artistic_license_2_0.
*/
-
#include <assert.h>
#include <props.h>
#define MAX_URIDS 512
+#define PROPS_PREFIX "http://open-music-kontrollers.ch/lv2/props#"
+#define PROPS_TEST_URI PROPS_PREFIX"test"
+
+#define MAX_NPROPS 1
+
+typedef struct _plugstate_t plugstate_t;
typedef struct _urid_t urid_t;
typedef void (*test_t)(props_t *props);
+struct _plugstate_t {
+ uint32_t foo;
+};
+
struct _urid_t {
LV2_URID urid;
char *uri;
@@ -57,51 +66,53 @@ static LV2_URID_Map map = {
.map = _map
};
+static const props_def_t defs [MAX_NPROPS] = {
+ {
+ .property = PROPS_PREFIX"foo",
+ .offset = offsetof(plugstate_t, foo),
+ .type = LV2_ATOM__Int
+ }
+};
+
+static plugstate_t state;
+static plugstate_t stash;
+
static void
_test_1(props_t *props)
{
assert(props);
- //FIXME
-}
-static void
-_test_2(props_t *props)
-{
- assert(props);
- //FIXME
-}
+ const LV2_URID property = props_map(props, PROPS_PREFIX"foo");
+ assert(property != 0);
-static const test_t tests [] = {
- _test_1,
- _test_2,
- NULL
-};
+ props_impl_t *impl = _props_impl_get(props, property);
+ assert(impl);
-#define PROPS_PREFIX "http://open-music-kontrollers.ch/lv2/props#"
-#define PROPS_TEST_URI PROPS_PREFIX"test"
+ assert(impl->property == property);
+ assert(impl->type != 0); //FIXME
+ assert(impl->access != 0); //FIXME
-#define MAX_NPROPS 1
+ assert(impl->value.size == sizeof(state.foo));
+ assert(impl->value.body == &state.foo);
-typedef struct _plugstate_t plugstate_t;
+ assert(impl->stash.size == sizeof(stash.foo));
+ assert(impl->stash.body == &stash.foo);
-struct _plugstate_t {
- uint32_t dummy;
-};
+ assert(impl->def == &defs[0]);
-static const props_def_t defs [MAX_NPROPS] = {
- {
- .property = PROPS_PREFIX"dummy",
- .offset = offsetof(plugstate_t, dummy),
- .type = LV2_ATOM__Int
- }
+ assert(atomic_load(&impl->state) == PROP_STATE_NONE);
+ assert(impl->stashing == false);
+}
+
+static const test_t tests [] = {
+ _test_1,
+ NULL
};
int
main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
{
static props_t props;
- static plugstate_t state;
- static plugstate_t stash;
for(const test_t *test = tests; *test; test++)
{