git » libfilo » commit fff6ced

More dirty tests.

author Alberto Bertogli
2005-04-24 00:38:08 UTC
committer Alberto Bertogli
2005-04-24 00:38:08 UTC
parent 342ad73032bada10cbf1afb42a797d443c221830

More dirty tests.

tests/test2.c +29 -0
tests/test3.c +29 -0

diff --git a/tests/test2.c b/tests/test2.c
new file mode 100644
index 0000000..b99f172
--- /dev/null
+++ b/tests/test2.c
@@ -0,0 +1,29 @@
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "libfilo.h"
+
+
+
+int main(int argc, char **argv) {
+	int max, i;
+	filock_t l;
+
+	max = atoi(argv[1]);
+	if (!max) {
+		exit(1);
+	}
+
+	filo_init(&l);
+
+	for (i = 0; i < max; i++) {
+		filo_lock(&l, 0, 100, FL_WR_MODE);
+		filo_unlock(&l, 0, 100);
+	}
+
+	return 0;
+
+}
+
diff --git a/tests/test3.c b/tests/test3.c
new file mode 100644
index 0000000..1556358
--- /dev/null
+++ b/tests/test3.c
@@ -0,0 +1,29 @@
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "libfilo.h"
+
+
+
+int main(int argc, char **argv) {
+	int max, i;
+	filock_t l;
+
+	max = atoi(argv[1]);
+	if (!max) {
+		exit(1);
+	}
+
+	filo_init(&l);
+
+	for (i = 0; i < max; i++) {
+		filo_plockf(&l, FL_LOCKW, 0, 100);
+		filo_plockf(&l, FL_ULOCK, 0, 100);
+	}
+
+	return 0;
+
+}
+