Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision 01579ad1020d073a91a73278666eb1fa947e04f5)
+++ boot/Makefile.common	(revision 2bff9860582fb5829fc4319ce726f51252f7e922)
@@ -238,4 +238,5 @@
 
 RD_TESTS = \
+	$(USPACE_PATH)/lib/c/test-libc
 
 
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 01579ad1020d073a91a73278666eb1fa947e04f5)
+++ uspace/lib/c/Makefile	(revision 2bff9860582fb5829fc4319ce726f51252f7e922)
@@ -153,4 +153,8 @@
 	$(ARCH_SOURCES)
 
+TEST_SOURCES = \
+	test/main.c \
+	test/sprintf.c
+
 include $(USPACE_PREFIX)/Makefile.common
 
Index: uspace/lib/c/test/main.c
===================================================================
--- uspace/lib/c/test/main.c	(revision 2bff9860582fb5829fc4319ce726f51252f7e922)
+++ uspace/lib/c/test/main.c	(revision 2bff9860582fb5829fc4319ce726f51252f7e922)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <pcut/test.h>
+
+PCUT_INIT
+
+PCUT_IMPORT(sprintf);
+
+PCUT_MAIN()
Index: uspace/lib/c/test/sprintf.c
===================================================================
--- uspace/lib/c/test/sprintf.c	(revision 2bff9860582fb5829fc4319ce726f51252f7e922)
+++ uspace/lib/c/test/sprintf.c	(revision 2bff9860582fb5829fc4319ce726f51252f7e922)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <pcut/test.h>
+
+#define BUFFER_SIZE 8192
+#define TEQ(expected, actual) PCUT_ASSERT_STR_EQUALS(expected, actual)
+#define TF(expected, format, ...) TEQ(expected, fmt(format, ##__VA_ARGS__))
+
+
+#define SPRINTF_TEST(test_name, expected_string, actual_format, ...) \
+	PCUT_TEST(test_name) { \
+		snprintf(buffer, BUFFER_SIZE, actual_format, ##__VA_ARGS__); \
+		PCUT_ASSERT_STR_EQUALS(expected_string, buffer); \
+	}
+
+PCUT_INIT
+
+PCUT_TEST_SUITE(sprintf)
+
+static char buffer[BUFFER_SIZE];
+
+PCUT_TEST_BEFORE {
+	memset(buffer, 0, BUFFER_SIZE);
+}
+
+
+
+SPRINTF_TEST(no_formatting, "This is a test.", "This is a test.")
+
+
+
+SPRINTF_TEST(string_plain, "some text", "%s", "some text")
+
+SPRINTF_TEST(string_dynamic_width, "  tex", "%*.*s", 5, 3, "text")
+
+SPRINTF_TEST(string_dynamic_width_align_left, "text   ", "%-*.*s", 7, 7, "text")
+
+SPRINTF_TEST(string_pad, "    text", "%8.10s", "text")
+
+SPRINTF_TEST(string_pad_but_cut, "  very lon", "%10.8s", "very long text")
+
+
+
+SPRINTF_TEST(char_basic, "[a]", "[%c]", 'a')
+
+
+
+SPRINTF_TEST(int_various_padding, "[1] [ 02] [03 ] [004] [005]",
+    "[%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]",
+    1, 2, 3, 4, 5)
+
+SPRINTF_TEST(int_negative_various_padding, "[-1] [-02] [-03] [-004] [-005]",
+    "[%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]",
+    -1, -2, -3, -4, -5)
+
+SPRINTF_TEST(long_negative_various_padding, "[-1] [-02] [-03] [-004] [-005]",
+    "[%lld] [%3.2lld] [%-3.2lld] [%2.3lld] [%-2.3lld]",
+    (long long) -1, (long long) -2, (long long) -3, (long long) -4,
+    (long long) -5)
+
+SPRINTF_TEST(int_as_hex, "[0x11] [0x012] [0x013] [0x00014] [0x00015]",
+    "[%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]",
+    17, 18, 19, 20, 21)
+
+
+
+
+PCUT_EXPORT(sprintf);
