summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spprintk/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/sptests/spprintk/init.c')
-rw-r--r--testsuites/sptests/spprintk/init.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/testsuites/sptests/spprintk/init.c b/testsuites/sptests/spprintk/init.c
index ffabb9ae91..4fc1c0cc97 100644
--- a/testsuites/sptests/spprintk/init.c
+++ b/testsuites/sptests/spprintk/init.c
@@ -1,19 +1,39 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/*
* Exercise putk, printk, and getchark
*
* COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <rtems/score/io.h>
+#include <rtems/base64.h>
+#include <rtems/dev/io.h>
/*
* Undefined the RTEMS_PRINTFLIKE and make it nothing. The test code
@@ -193,52 +213,52 @@ static void test_io_base64( test_context *ctx )
int n;
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 9, "\n", 0 );
+ n = _Base64_Encode( put_char, ctx, buf, 9, "\n", 0 );
rtems_test_assert( n == 14 );
rtems_test_assert( strcmp( ctx->buf, "YWJj\nZGVm\nZ2hp" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 8, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 8, "\n", 4 );
rtems_test_assert( n == 14 );
rtems_test_assert( strcmp( ctx->buf, "YWJj\nZGVm\nZ2g=" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 7, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 7, "\n", 4 );
rtems_test_assert( n == 14 );
rtems_test_assert( strcmp( ctx->buf, "YWJj\nZGVm\nZw==" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 6, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 6, "\n", 4 );
rtems_test_assert( n == 9 );
rtems_test_assert( strcmp( ctx->buf, "YWJj\nZGVm" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 5, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 5, "\n", 4 );
rtems_test_assert( n == 9 );
rtems_test_assert( strcmp( ctx->buf, "YWJj\nZGU=" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 4, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 4, "\n", 4 );
rtems_test_assert( n == 9 );
rtems_test_assert( strcmp( ctx->buf, "YWJj\nZA==" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 3, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 3, "\n", 4 );
rtems_test_assert( n == 4 );
rtems_test_assert( strcmp( ctx->buf, "YWJj" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 2, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 2, "\n", 4 );
rtems_test_assert( n == 4 );
rtems_test_assert( strcmp( ctx->buf, "YWI=" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 1, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 1, "\n", 4 );
rtems_test_assert( n == 4 );
rtems_test_assert( strcmp( ctx->buf, "YQ==" ) == 0 );
clear( ctx );
- n = _IO_Base64( put_char, ctx, buf, 0, "\n", 4 );
+ n = _Base64_Encode( put_char, ctx, buf, 0, "\n", 4 );
rtems_test_assert( n == 0 );
}
@@ -248,7 +268,7 @@ static void test_io_base64url( test_context *ctx )
int n;
clear( ctx );
- n = _IO_Base64url( put_char, ctx, buf, sizeof( buf ), "\n", 0 );
+ n = _Base64url_Encode( put_char, ctx, buf, sizeof( buf ), "\n", 0 );
rtems_test_assert( n == 9 );
rtems_test_assert( strcmp( ctx->buf, "AAA-\nAAA_" ) == 0 );
}