dovecot-2.2: lib: Renamed test-network to test-net
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 29 15:45:00 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/334bb95f27d4
changeset: 18501:334bb95f27d4
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 29 17:36:44 2015 +0200
description:
lib: Renamed test-network to test-net
Since network.c had been renamed to net.c some time ago.
diffstat:
src/lib/Makefile.am | 2 +-
src/lib/test-lib.c | 2 +-
src/lib/test-lib.h | 2 +-
src/lib/test-net.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/test-network.c | 53 --------------------------------------------------
5 files changed, 56 insertions(+), 56 deletions(-)
diffs (150 lines):
diff -r 4903ab967807 -r 334bb95f27d4 src/lib/Makefile.am
--- a/src/lib/Makefile.am Wed Apr 29 17:35:18 2015 +0200
+++ b/src/lib/Makefile.am Wed Apr 29 17:36:44 2015 +0200
@@ -310,7 +310,7 @@
test-json-tree.c \
test-llist.c \
test-mempool-alloconly.c \
- test-network.c \
+ test-net.c \
test-numpack.c \
test-ostream-file.c \
test-primes.c \
diff -r 4903ab967807 -r 334bb95f27d4 src/lib/test-lib.c
--- a/src/lib/test-lib.c Wed Apr 29 17:35:18 2015 +0200
+++ b/src/lib/test-lib.c Wed Apr 29 17:36:44 2015 +0200
@@ -32,7 +32,7 @@
test_json_tree,
test_llist,
test_mempool_alloconly,
- test_network,
+ test_net,
test_numpack,
test_ostream_file,
test_primes,
diff -r 4903ab967807 -r 334bb95f27d4 src/lib/test-lib.h
--- a/src/lib/test-lib.h Wed Apr 29 17:35:18 2015 +0200
+++ b/src/lib/test-lib.h Wed Apr 29 17:36:44 2015 +0200
@@ -34,7 +34,7 @@
void test_llist(void);
void test_mempool_alloconly(void);
enum fatal_test_state fatal_mempool(int);
-void test_network(void);
+void test_net(void);
void test_numpack(void);
void test_ostream_file(void);
void test_primes(void);
diff -r 4903ab967807 -r 334bb95f27d4 src/lib/test-net.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/test-net.c Wed Apr 29 17:36:44 2015 +0200
@@ -0,0 +1,53 @@
+/* Copyright (c) 2007-2015 Dovecot authors, see the included COPYING file */
+
+#include "test-lib.h"
+#include "net.h"
+
+struct test_net_is_in_network_input {
+ const char *ip;
+ const char *net;
+ unsigned int bits;
+ bool ret;
+};
+
+static void test_net_is_in_network(void)
+{
+ static struct test_net_is_in_network_input input[] = {
+ { "1.2.3.4", "1.2.3.4", 32, TRUE },
+ { "1.2.3.4", "1.2.3.3", 32, FALSE },
+ { "1.2.3.4", "1.2.3.5", 32, FALSE },
+ { "1.2.3.4", "1.2.2.4", 32, FALSE },
+ { "1.2.3.4", "1.1.3.4", 32, FALSE },
+ { "1.2.3.4", "0.2.3.4", 32, FALSE },
+ { "1.2.3.253", "1.2.3.254", 31, FALSE },
+ { "1.2.3.254", "1.2.3.254", 31, TRUE },
+ { "1.2.3.255", "1.2.3.254", 31, TRUE },
+ { "1.2.3.255", "1.2.3.0", 24, TRUE },
+ { "1.2.255.255", "1.2.254.0", 23, TRUE },
+ { "255.255.255.255", "128.0.0.0", 1, TRUE },
+ { "255.255.255.255", "127.0.0.0", 1, FALSE }
+#ifdef HAVE_IPV6
+ ,
+ { "1234:5678::abcf", "1234:5678::abce", 127, TRUE },
+ { "1234:5678::abcd", "1234:5678::abce", 127, FALSE },
+ { "123e::ffff", "123e::0", 15, TRUE },
+ { "123d::ffff", "123e::0", 15, FALSE }
+#endif
+ };
+ struct ip_addr ip, net_ip;
+ unsigned int i;
+ bool success;
+
+ for (i = 0; i < N_ELEMENTS(input); i++) {
+ test_assert(net_addr2ip(input[i].ip, &ip) == 0);
+ test_assert(net_addr2ip(input[i].net, &net_ip) == 0);
+ success = net_is_in_network(&ip, &net_ip, input[i].bits) ==
+ input[i].ret;
+ test_out(t_strdup_printf("net_is_in_network(%u)", i), success);
+ }
+}
+
+void test_net(void)
+{
+ test_net_is_in_network();
+}
diff -r 4903ab967807 -r 334bb95f27d4 src/lib/test-network.c
--- a/src/lib/test-network.c Wed Apr 29 17:35:18 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* Copyright (c) 2007-2015 Dovecot authors, see the included COPYING file */
-
-#include "test-lib.h"
-#include "net.h"
-
-struct test_net_is_in_network_input {
- const char *ip;
- const char *net;
- unsigned int bits;
- bool ret;
-};
-
-static void test_net_is_in_network(void)
-{
- static struct test_net_is_in_network_input input[] = {
- { "1.2.3.4", "1.2.3.4", 32, TRUE },
- { "1.2.3.4", "1.2.3.3", 32, FALSE },
- { "1.2.3.4", "1.2.3.5", 32, FALSE },
- { "1.2.3.4", "1.2.2.4", 32, FALSE },
- { "1.2.3.4", "1.1.3.4", 32, FALSE },
- { "1.2.3.4", "0.2.3.4", 32, FALSE },
- { "1.2.3.253", "1.2.3.254", 31, FALSE },
- { "1.2.3.254", "1.2.3.254", 31, TRUE },
- { "1.2.3.255", "1.2.3.254", 31, TRUE },
- { "1.2.3.255", "1.2.3.0", 24, TRUE },
- { "1.2.255.255", "1.2.254.0", 23, TRUE },
- { "255.255.255.255", "128.0.0.0", 1, TRUE },
- { "255.255.255.255", "127.0.0.0", 1, FALSE }
-#ifdef HAVE_IPV6
- ,
- { "1234:5678::abcf", "1234:5678::abce", 127, TRUE },
- { "1234:5678::abcd", "1234:5678::abce", 127, FALSE },
- { "123e::ffff", "123e::0", 15, TRUE },
- { "123d::ffff", "123e::0", 15, FALSE }
-#endif
- };
- struct ip_addr ip, net_ip;
- unsigned int i;
- bool success;
-
- for (i = 0; i < N_ELEMENTS(input); i++) {
- test_assert(net_addr2ip(input[i].ip, &ip) == 0);
- test_assert(net_addr2ip(input[i].net, &net_ip) == 0);
- success = net_is_in_network(&ip, &net_ip, input[i].bits) ==
- input[i].ret;
- test_out(t_strdup_printf("net_is_in_network(%u)", i), success);
- }
-}
-
-void test_network(void)
-{
- test_net_is_in_network();
-}
More information about the dovecot-cvs
mailing list