summaryrefslogtreecommitdiffstats
path: root/tests/lib/test_heavy.c
diff options
context:
space:
mode:
authorwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:03:14 +0200
committerwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:04:07 +0200
commitd62a17aedeb0eebdba98238874bb13d62c48dbf9 (patch)
tree3b319b1d61c8b85b4d1f06adf8b844bb8a9b5107 /tests/lib/test_heavy.c
parent*: add indent control files (diff)
downloadfrr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.tar.xz
frr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.zip
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tests/lib/test_heavy.c')
-rw-r--r--tests/lib/test_heavy.c97
1 files changed, 45 insertions, 52 deletions
diff --git a/tests/lib/test_heavy.c b/tests/lib/test_heavy.c
index c6f6bbba2..604a5733c 100644
--- a/tests/lib/test_heavy.c
+++ b/tests/lib/test_heavy.c
@@ -37,46 +37,42 @@
#include "tests.h"
-enum
-{
- ITERS_FIRST = 0,
- ITERS_ERR = 100,
- ITERS_LATER = 400,
- ITERS_PRINT = 10,
- ITERS_MAX = 1000,
+enum { ITERS_FIRST = 0,
+ ITERS_ERR = 100,
+ ITERS_LATER = 400,
+ ITERS_PRINT = 10,
+ ITERS_MAX = 1000,
};
-static void
-slow_func (struct vty *vty, const char *str, const int i)
+static void slow_func(struct vty *vty, const char *str, const int i)
{
- double x = 1;
- int j;
-
- for (j = 0; j < 300; j++)
- x += sin(x)*j;
-
- if ((i % ITERS_LATER) == 0)
- printf ("%s: %d, temporary error, save this somehow and do it later..\n",
- __func__, i);
-
- if ((i % ITERS_ERR) == 0)
- printf ("%s: hard error\n", __func__);
-
- if ((i % ITERS_PRINT) == 0)
- printf ("%s did %d, x = %g\n", str, i, x);
+ double x = 1;
+ int j;
+
+ for (j = 0; j < 300; j++)
+ x += sin(x) * j;
+
+ if ((i % ITERS_LATER) == 0)
+ printf("%s: %d, temporary error, save this somehow and do it later..\n",
+ __func__, i);
+
+ if ((i % ITERS_ERR) == 0)
+ printf("%s: hard error\n", __func__);
+
+ if ((i % ITERS_PRINT) == 0)
+ printf("%s did %d, x = %g\n", str, i, x);
}
-static void
-clear_something (struct vty *vty, const char *str)
+static void clear_something(struct vty *vty, const char *str)
{
- int i;
-
- /* this could be like iterating through 150k of route_table
- * or worse, iterating through a list of peers, to bgp_stop them with
- * each having 150k route tables to process...
- */
- for (i = ITERS_FIRST; i < ITERS_MAX; i++)
- slow_func (vty, str, i);
+ int i;
+
+ /* this could be like iterating through 150k of route_table
+ * or worse, iterating through a list of peers, to bgp_stop them with
+ * each having 150k route tables to process...
+ */
+ for (i = ITERS_FIRST; i < ITERS_MAX; i++)
+ slow_func(vty, str, i);
}
DEFUN (clear_foo,
@@ -85,28 +81,25 @@ DEFUN (clear_foo,
"clear command\n"
"arbitrary string\n")
{
- char *str;
- if (!argc)
- {
- vty_out (vty, "%% string argument required\n");
- return CMD_WARNING;
- }
-
- str = argv_concat (argv, argc, 0);
-
- clear_something (vty, str);
- XFREE (MTYPE_TMP, str);
- return CMD_SUCCESS;
+ char *str;
+ if (!argc) {
+ vty_out(vty, "%% string argument required\n");
+ return CMD_WARNING;
+ }
+
+ str = argv_concat(argv, argc, 0);
+
+ clear_something(vty, str);
+ XFREE(MTYPE_TMP, str);
+ return CMD_SUCCESS;
}
-static void
-slow_vty_init()
+static void slow_vty_init()
{
- install_element (VIEW_NODE, &clear_foo_cmd);
+ install_element(VIEW_NODE, &clear_foo_cmd);
}
-void
-test_init()
+void test_init()
{
- slow_vty_init();
+ slow_vty_init();
}