Browse Source

initial checkin

master
Richard Kreckel 25 years ago
commit
d57000b193
  1. 13
      CVSROOT/checkoutlist
  2. 15
      CVSROOT/commitinfo
  3. 6
      CVSROOT/config
  4. 23
      CVSROOT/cvswrappers
  5. 21
      CVSROOT/editinfo
  6. 26
      CVSROOT/loginfo
  7. 26
      CVSROOT/modules
  8. 12
      CVSROOT/notify
  9. 13
      CVSROOT/rcsinfo
  10. 20
      CVSROOT/taginfo
  11. 21
      CVSROOT/verifymsg

13
CVSROOT/checkoutlist

@ -0,0 +1,13 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'

15
CVSROOT/commitinfo

@ -0,0 +1,15 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

6
CVSROOT/config

@ -0,0 +1,6 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Set `PreservePermissions' to `yes' to save file status information
# in the repository.
#PreservePermissions=no

23
CVSROOT/cvswrappers

@ -0,0 +1,23 @@
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'

21
CVSROOT/editinfo

@ -0,0 +1,21 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

26
CVSROOT/loginfo

@ -0,0 +1,26 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog

26
CVSROOT/modules

@ -0,0 +1,26 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

12
CVSROOT/notify

@ -0,0 +1,12 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"

HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Set-Cookie: i_like_gitea=ed0585c0d56bc638; Path=/; HttpOnly; SameSite=Lax Set-Cookie: _csrf=hMPwzetG6HEn24212YOTkHcBAjY6MTczNDk4MTA5MTE0MTUxMDQ3MQ; Path=/; Expires=Tue, 24 Dec 2024 19:11:31 GMT; HttpOnly; SameSite=Lax Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Mon, 23 Dec 2024 19:11:31 GMT Transfer-Encoding: chunked db16 sp/cln_mirror - include/cln/output.h at 6d4cabf35e0bc58bac8d4a348c9d2349df183fdf - cln_mirror - Gitea: Git with a cup of tea
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

74 lines
1.9 KiB

// Output functions.
#ifndef _CL_OUTPUT_H
#define _CL_OUTPUT_H
#include "cln/types.h"
#include "cln/floatformat.h"
#include "cln/io.h"
#include "cln/string.h"
namespace cln {
struct cl_print_rational_flags {
// Base in which rational numbers are to be printed.
unsigned int rational_base;
// Flag whether to print radix specifiers in Common Lisp syntax for
// rational numbers (#nR or #b or #o or #x prefixes, trailing dot).
cl_boolean rational_readably;
// Constructor.
cl_print_rational_flags () :
rational_base (10),
rational_readably (cl_false) {}
};
struct cl_print_float_flags {
// Flag whether to prefer type specific exponent markers over 'E'.
cl_boolean float_readably;
// If !float_readably, the format which earns the 'E' exponent marker.
float_format_t default_float_format;
// Constructor.
cl_print_float_flags () :
float_readably (cl_false),
default_float_format (float_format_ffloat) {}
};
struct cl_print_real_flags : cl_print_rational_flags, cl_print_float_flags {};
struct cl_print_complex_flags {
// Flag whether to use the Common Lisp #C(realpart imagpart) syntax,
cl_boolean complex_readably;
// Constructor.
cl_print_complex_flags () :
complex_readably (cl_false) {}
};
struct cl_print_number_flags : cl_print_real_flags, cl_print_complex_flags {};
enum cl_print_vector_syntax_t {
vsyntax_algebraic, // [a, b, c]
vsyntax_pretty, // [a b c]
vsyntax_commonlisp // #(a b c)
};
struct cl_print_vector_flags {
cl_print_vector_syntax_t vector_syntax;
// Constructor.
cl_print_vector_flags () :
vector_syntax (vsyntax_pretty) {}
};
struct cl_print_univpoly_flags {
cl_string univpoly_varname;
// Constructor.
cl_print_univpoly_flags () :
univpoly_varname ("x") {}
};
struct cl_print_flags : cl_print_number_flags, cl_print_vector_flags, cl_print_univpoly_flags {};
extern cl_print_flags default_print_flags;
} // namespace cln
#endif /* _CL_OUTPUT_H */
0 HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Set-Cookie: i_like_gitea=ef3244eb29401f65; Path=/; HttpOnly; SameSite=Lax Set-Cookie: _csrf=zP6c9sZb1aalG48bcYPI-kQFLKE6MTczNDk4MTA5MTA2OTA2MTE4Nw; Path=/; Expires=Tue, 24 Dec 2024 19:11:31 GMT; HttpOnly; SameSite=Lax Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Mon, 23 Dec 2024 19:11:31 GMT Transfer-Encoding: chunked 20663 sp/tempestpy - resources/pybind11/tests/test_builtin_casters.py at da97ba15909014b1f3a15428ccdc45888712050d - tempestpy - Gitea: Git with a cup of tea
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

221 lines
7.8 KiB

# Python < 3 needs this: coding=utf-8
import pytest
from pybind11_tests import builtin_casters as m
from pybind11_tests import UserType, IncType
def test_simple_string():
assert m.string_roundtrip("const char *") == "const char *"
def test_unicode_conversion():
"""Tests unicode conversion and error reporting."""
assert m.good_utf8_string() == u"Say utf8โ€ฝ ๐ŸŽ‚ ๐€"
assert m.good_utf16_string() == u"bโ€ฝ๐ŸŽ‚๐€z"
assert m.good_utf32_string() == u"a๐€๐ŸŽ‚โ€ฝz"
assert m.good_wchar_string() == u"aโธ˜๐€z"
with pytest.raises(UnicodeDecodeError):
m.bad_utf8_string()
with pytest.raises(UnicodeDecodeError):
m.bad_utf16_string()
# These are provided only if they actually fail (they don't when 32-bit and under Python 2.7)
if hasattr(m, "bad_utf32_string"):
with pytest.raises(UnicodeDecodeError):
m.bad_utf32_string()
if hasattr(m, "bad_wchar_string"):
with pytest.raises(UnicodeDecodeError):
m.bad_wchar_string()
assert m.u8_Z() == 'Z'
assert m.u8_eacute() == u'รฉ'
assert m.u16_ibang() == u'โ€ฝ'
assert m.u32_mathbfA() == u'๐€'
assert m.wchar_heart() == u'โ™ฅ'
def test_single_char_arguments():
"""Tests failures for passing invalid inputs to char-accepting functions"""
def toobig_message(r):
return "Character code point not in range({0:#x})".format(r)
toolong_message = "Expected a character, but multi-character string found"
assert m.ord_char(u'a') == 0x61 # simple ASCII
assert m.ord_char(u'รฉ') == 0xE9 # requires 2 bytes in utf-8, but can be stuffed in a char
with pytest.raises(ValueError) as excinfo:
assert m.ord_char(u'ฤ€') == 0x100 # requires 2 bytes, doesn't fit in a char
assert str(excinfo.value) == toobig_message(0x100)
with pytest.raises(ValueError) as excinfo:
assert m.ord_char(u'ab')
assert str(excinfo.value) == toolong_message
assert m.ord_char16(u'a') == 0x61
assert m.ord_char16(u'รฉ') == 0xE9
assert m.ord_char16(u'ฤ€') == 0x100
assert m.ord_char16(u'โ€ฝ') == 0x203d
assert m.ord_char16(u'โ™ฅ') == 0x2665
with pytest.raises(ValueError) as excinfo:
assert m.ord_char16(u'๐ŸŽ‚') == 0x1F382 # requires surrogate pair
assert str(excinfo.value) == toobig_message(0x10000)
with pytest.raises(ValueError) as excinfo:
assert m.ord_char16(u'aa')
assert str(excinfo.value) == toolong_message
assert m.ord_char32(u'a') == 0x61
assert m.ord_char32(u'รฉ') == 0xE9
assert m.ord_char32(u'ฤ€') == 0x100
assert m.ord_char32(u'โ€ฝ') == 0x203d
assert m.ord_char32(u'โ™ฅ') == 0x2665
assert m.ord_char32(u'๐ŸŽ‚') == 0x1F382
with pytest.raises(ValueError) as excinfo:
assert m.ord_char32(u'aa')
assert str(excinfo.value) == toolong_message
assert m.ord_wchar(u'a') == 0x61
assert m.ord_wchar(u'รฉ') == 0xE9
assert m.ord_wchar(u'ฤ€') == 0x100
assert m.ord_wchar(u'โ€ฝ') == 0x203d
assert m.ord_wchar(u'โ™ฅ') == 0x2665
if m.wchar_size == 2:
with pytest.raises(ValueError) as excinfo:
assert m.ord_wchar(u'๐ŸŽ‚') == 0x1F382 # requires surrogate pair
assert str(excinfo.value) == toobig_message(0x10000)
else:
assert m.ord_wchar(u'๐ŸŽ‚') == 0x1F382
with pytest.raises(ValueError) as excinfo:
assert m.ord_wchar(u'aa')
assert str(excinfo.value) == toolong_message
def test_bytes_to_string():
"""Tests the ability to pass bytes to C++ string-accepting functions. Note that this is
one-way: the only way to return bytes to Python is via the pybind11::bytes class."""
# Issue #816
import sys
byte = bytes if sys.version_info[0] < 3 else str
assert m.strlen(byte("hi")) == 2
assert m.string_length(byte("world")) == 5
assert m.string_length(byte("a\x00b")) == 3
assert m.strlen(byte("a\x00b")) == 1 # C-string limitation
# passing in a utf8 encoded string should work
assert m.string_length(u'๐Ÿ’ฉ'.encode("utf8")) == 4
@pytest.mark.skipif(not hasattr(m, "has_string_view"), reason="no <string_view>")
def test_string_view(capture):
"""Tests support for C++17 string_view arguments and return values"""
assert m.string_view_chars("Hi") == [72, 105]
assert m.string_view_chars("Hi ๐ŸŽ‚") == [72, 105, 32, 0xf0, 0x9f, 0x8e, 0x82]
assert m.string_view16_chars("Hi ๐ŸŽ‚") == [72, 105, 32, 0xd83c, 0xdf82]
assert m.string_view32_chars("Hi ๐ŸŽ‚") == [72, 105, 32, 127874]
assert m.string_view_return() == "utf8 secret ๐ŸŽ‚"
assert m.string_view16_return() == "utf16 secret ๐ŸŽ‚"
assert m.string_view32_return() == "utf32 secret ๐ŸŽ‚"
with capture:
m.string_view_print("Hi")
m.string_view_print("utf8 ๐ŸŽ‚")
m.string_view16_print("utf16 ๐ŸŽ‚")
m.string_view32_print("utf32 ๐ŸŽ‚")
assert capture == """
Hi 2
utf8 ๐ŸŽ‚ 9
utf16 ๐ŸŽ‚ 8
utf32 ๐ŸŽ‚ 7
"""
with capture:
m.string_view_print("Hi, ascii")
m.string_view_print("Hi, utf8 ๐ŸŽ‚")
m.string_view16_print("Hi, utf16 ๐ŸŽ‚")
m.string_view32_print("Hi, utf32 ๐ŸŽ‚")
assert capture == """
Hi, ascii 9
Hi, utf8 ๐ŸŽ‚ 13
Hi, utf16 ๐ŸŽ‚ 12
Hi, utf32 ๐ŸŽ‚ 11
"""
def test_tuple(doc):
"""std::pair <-> tuple & std::tuple <-> tuple"""
assert m.pair_passthrough((True, "test")) == ("test", True)
assert m.tuple_passthrough((True, "test", 5)) == (5, "test", True)
# Any sequence can be cast to a std::pair or std::tuple
assert m.pair_passthrough([True, "test"]) == ("test", True)
assert m.tuple_passthrough([True, "test", 5]) == (5, "test", True)
assert doc(m.pair_passthrough) == """
pair_passthrough(arg0: Tuple[bool, str]) -> Tuple[str, bool]
Return a pair in reversed order
"""
assert doc(m.tuple_passthrough) == """
tuple_passthrough(arg0: Tuple[bool, str, int]) -> Tuple[int, str, bool]
Return a triple in reversed order
"""
def test_builtins_cast_return_none():
"""Casters produced with PYBIND11_TYPE_CASTER() should convert nullptr to None"""
assert m.return_none_string() is None
assert m.return_none_char() is None
assert m.return_none_bool() is None
assert m.return_none_int() is None
assert m.return_none_float() is None
def test_none_deferred():
"""None passed as various argument types should defer to other overloads"""
assert not m.defer_none_cstring("abc")
assert m.defer_none_cstring(None)
assert not m.defer_none_custom(UserType())
assert m.defer_none_custom(None)
assert m.nodefer_none_void(None)
def test_void_caster():
assert m.load_nullptr_t(None) is None
assert m.cast_nullptr_t() is None
def test_reference_wrapper():
"""std::reference_wrapper for builtin and user types"""
assert m.refwrap_builtin(42) == 420
assert m.refwrap_usertype(UserType(42)) == 42
with pytest.raises(TypeError) as excinfo:
m.refwrap_builtin(None)
assert "incompatible function arguments" in str(excinfo.value)
with pytest.raises(TypeError) as excinfo:
m.refwrap_usertype(None)
assert "incompatible function arguments" in str(excinfo.value)
a1 = m.refwrap_list(copy=True)
a2 = m.refwrap_list(copy=True)
assert [x.value for x in a1] == [2, 3]
assert [x.value for x in a2] == [2, 3]
assert not a1[0] is a2[0] and not a1[1] is a2[1]
b1 = m.refwrap_list(copy=False)
b2 = m.refwrap_list(copy=False)
assert [x.value for x in b1] == [1, 2]
assert [x.value for x in b2] == [1, 2]
assert b1[0] is b2[0] and b1[1] is b2[1]
assert m.refwrap_iiw(IncType(5)) == 5
assert m.refwrap_call_iiw(