aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorallusive-dev <[email protected]>2023-11-18 08:21:51 +1100
committerallusive-dev <[email protected]>2023-11-18 08:21:51 +1100
commitbe87e3336f7f897db5e089d673d2a288ff783af9 (patch)
treee5fbf0a2c3f49e99d0aeddaf510b6ae4ee918e2d /src
parentupdate contributors (diff)
downloadcompfy-1.7.1.tar.xz
compfy-1.7.1.zip
deprecate sub-projects and testing1.7.1
Diffstat (limited to 'src')
-rw-r--r--src/compfy.c1
-rw-r--r--src/config.c32
-rw-r--r--src/meson.build2
-rw-r--r--src/string_utils.c59
-rw-r--r--src/utils.h2
5 files changed, 1 insertions, 95 deletions
diff --git a/src/compfy.c b/src/compfy.c
index 29cbe08..975bfaf 100644
--- a/src/compfy.c
+++ b/src/compfy.c
@@ -21,7 +21,6 @@
#include <xcb/xinerama.h>
#include <ev.h>
-#include <test.h>
#include "common.h"
#include "compiler.h"
diff --git a/src/config.c b/src/config.c
index d23a69a..deca6ad 100644
--- a/src/config.c
+++ b/src/config.c
@@ -16,8 +16,6 @@
#include <unistd.h>
#include <xcb/render.h> // for xcb_render_fixed_t, XXX
-#include <test.h>
-
#include "c2.h"
#include "common.h"
#include "compiler.h"
@@ -93,36 +91,6 @@ char **xdg_config_dirs(void) {
return dir_list;
}
-TEST_CASE(xdg_config_dirs) {
- auto old_var = getenv("XDG_CONFIG_DIRS");
- if (old_var) {
- old_var = strdup(old_var);
- }
- unsetenv("XDG_CONFIG_DIRS");
-
- auto result = xdg_config_dirs();
- TEST_STREQUAL(result[0], "/etc/xdg");
- TEST_EQUAL(result[1], NULL);
- free(result);
-
- setenv("XDG_CONFIG_DIRS", ".:.:/etc/xdg:.:/:", 1);
- result = xdg_config_dirs();
- TEST_STREQUAL(result[0], "/etc/xdg");
- TEST_STREQUAL(result[1], "/");
- TEST_EQUAL(result[2], NULL);
- free(result);
-
- setenv("XDG_CONFIG_DIRS", ":", 1);
- result = xdg_config_dirs();
- TEST_EQUAL(result[0], NULL);
- free(result);
-
- if (old_var) {
- setenv("XDG_CONFIG_DIRS", old_var, 1);
- free(old_var);
- }
-}
-
/**
* Parse a long number.
*/
diff --git a/src/meson.build b/src/meson.build
index 60d1893..a1da5a6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -91,7 +91,7 @@ endif
subdir('backend')
compfy = executable('compfy', srcs, c_args: cflags,
- dependencies: [ base_deps, deps, test_h_dep ],
+ dependencies: [ base_deps, deps ],
install: true, include_directories: compfy_inc)
if get_option('unittest')
diff --git a/src/string_utils.c b/src/string_utils.c
index ee5bb2d..871f29a 100644
--- a/src/string_utils.c
+++ b/src/string_utils.c
@@ -3,8 +3,6 @@
#include <string.h>
-#include <test.h>
-
#include "compiler.h"
#include "string_utils.h"
#include "utils.h"
@@ -35,20 +33,6 @@ char *mstrjoin(const char *src1, const char *src2) {
return str;
}
-TEST_CASE(mstrjoin) {
- char *str = mstrjoin("asdf", "qwer");
- TEST_STREQUAL(str, "asdfqwer");
- free(str);
-
- str = mstrjoin("", "qwer");
- TEST_STREQUAL(str, "qwer");
- free(str);
-
- str = mstrjoin("asdf", "");
- TEST_STREQUAL(str, "asdf");
- free(str);
-}
-
/**
* Concatenate a string on heap with another string.
*/
@@ -67,19 +51,6 @@ void mstrextend(char **psrc1, const char *src2) {
(*psrc1)[len - 1] = '\0';
}
-TEST_CASE(mstrextend) {
- char *str1 = NULL;
- mstrextend(&str1, "asdf");
- TEST_STREQUAL(str1, "asdf");
-
- mstrextend(&str1, "asd");
- TEST_STREQUAL(str1, "asdfasd");
-
- mstrextend(&str1, "");
- TEST_STREQUAL(str1, "asdfasd");
- free(str1);
-}
-
#pragma GCC diagnostic pop
/// Parse a floating point number of form (+|-)?[0-9]*(\.[0-9]*)
@@ -113,21 +84,6 @@ double strtod_simple(const char *src, const char **end) {
return ret * neg;
}
-TEST_CASE(strtod_simple) {
- const char *end;
- double result = strtod_simple("1.0", &end);
- TEST_EQUAL(result, 1);
- TEST_EQUAL(*end, '\0');
-
- result = strtod_simple("-1.0", &end);
- TEST_EQUAL(result, -1);
- TEST_EQUAL(*end, '\0');
-
- result = strtod_simple("+.5", &end);
- TEST_EQUAL(result, 0.5);
- TEST_EQUAL(*end, '\0');
-}
-
const char *trim_both(const char *src, size_t *length) {
size_t i = 0;
while (isspace(src[i])) {
@@ -140,18 +96,3 @@ const char *trim_both(const char *src, size_t *length) {
*length = j - i + 1;
return src + i;
}
-
-TEST_CASE(trim_both) {
- size_t length;
- const char *str = trim_both(" \t\n\r\f", &length);
- TEST_EQUAL(length, 0);
- TEST_EQUAL(*str, '\0');
-
- str = trim_both(" asdfas ", &length);
- TEST_EQUAL(length, 6);
- TEST_STRNEQUAL(str, "asdfas", length);
-
- str = trim_both(" asdf asdf ", &length);
- TEST_EQUAL(length, 9);
- TEST_STRNEQUAL(str, "asdf asdf", length);
-}
diff --git a/src/utils.h b/src/utils.h
index a35bfa8..80dab92 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -12,8 +12,6 @@
#include <string.h>
#include <unistd.h>
-#include <test.h>
-
#include <time.h>
#include "compiler.h"