1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2025-08-14 22:15:57 -04:00

Common: improve feature macros (#53)

This commit is contained in:
Alex Kotov 2022-06-13 22:55:05 +03:00 committed by GitHub
parent 940f981ef1
commit 42d626f868
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 111 additions and 111 deletions

View file

@ -9,7 +9,7 @@ module KernAux
SPRINTF1_BUFFER_SIZE = 10_000 SPRINTF1_BUFFER_SIZE = 10_000
if Version.supports_printf? if Version.with_printf?
def self.sprintf(*args) def self.sprintf(*args)
args.map do |arg| args.map do |arg|
if arg.is_a? Array if arg.is_a? Array

View file

@ -11,7 +11,7 @@
#define ARGV_COUNT_MAX 256 #define ARGV_COUNT_MAX 256
#define BUFFER_SIZE 4096 #define BUFFER_SIZE 4096
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
static mrb_value rb_KernAux_cmdline(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_cmdline(mrb_state *mrb, mrb_value self);
@ -69,4 +69,4 @@ mrb_value rb_KernAux_cmdline(mrb_state *const mrb, mrb_value self)
return mrb_obj_freeze(mrb, mrb_ary_new_from_values(mrb, argc, values)); return mrb_obj_freeze(mrb, mrb_ary_new_from_values(mrb, argc, values));
} }
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE

View file

@ -26,15 +26,15 @@ void mrb_mruby_kernaux_gem_init(mrb_state *const mrb)
init_assert(mrb); init_assert(mrb);
init_version(mrb); init_version(mrb);
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
init_cmdline(mrb); init_cmdline(mrb);
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
init_ntoa(mrb); init_ntoa(mrb);
#endif // KERNAUX_VERSION_SUPPORTS_NTOA #endif // KERNAUX_VERSION_WITH_NTOA
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
init_printf(mrb); init_printf(mrb);
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF #endif // KERNAUX_VERSION_WITH_PRINTF
} }
void current_mrb_start(mrb_state *mrb) void current_mrb_start(mrb_state *mrb)

View file

@ -11,14 +11,14 @@ mrb_state *current_mrb_get();
void init_assert(mrb_state *mrb); void init_assert(mrb_state *mrb);
void init_version(mrb_state *mrb); void init_version(mrb_state *mrb);
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
void init_cmdline(mrb_state *mrb); void init_cmdline(mrb_state *mrb);
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
void init_ntoa(mrb_state *mrb); void init_ntoa(mrb_state *mrb);
#endif // KERNAUX_VERSION_SUPPORTS_NTOA #endif // KERNAUX_VERSION_WITH_NTOA
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
void init_printf(mrb_state *mrb); void init_printf(mrb_state *mrb);
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF #endif // KERNAUX_VERSION_WITH_PRINTF
#endif #endif

View file

@ -6,7 +6,7 @@
#include <mruby/presym.h> #include <mruby/presym.h>
#include <mruby/string.h> #include <mruby/string.h>
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
static mrb_value rb_KernAux_utoa(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_utoa(mrb_state *mrb, mrb_value self);
static mrb_value rb_KernAux_itoa(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_itoa(mrb_state *mrb, mrb_value self);
@ -297,4 +297,4 @@ int convert_base(mrb_state *mrb, mrb_value base_rb)
} }
} }
#endif // KERNAUX_VERSION_SUPPORTS_NTOA #endif // KERNAUX_VERSION_WITH_NTOA

View file

@ -8,7 +8,7 @@
#include <mruby/presym.h> #include <mruby/presym.h>
#include <mruby/string.h> #include <mruby/string.h>
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
static mrb_value rb_KernAux_snprintf1(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_snprintf1(mrb_state *mrb, mrb_value self);
@ -121,4 +121,4 @@ mrb_value rb_KernAux_snprintf1(mrb_state *const mrb, mrb_value self)
return mrb_obj_freeze(mrb, mrb_ary_new_from_values(mrb, 2, values)); return mrb_obj_freeze(mrb, mrb_ary_new_from_values(mrb, 2, values));
} }
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF #endif // KERNAUX_VERSION_WITH_PRINTF

View file

@ -3,9 +3,9 @@
#include <mruby/presym.h> #include <mruby/presym.h>
#include <mruby/value.h> #include <mruby/value.h>
static mrb_value rb_KernAux_Version_supports_cmdlineQN(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_Version_with_cmdlineQN(mrb_state *mrb, mrb_value self);
static mrb_value rb_KernAux_Version_supports_ntoaQN(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_Version_with_ntoaQN(mrb_state *mrb, mrb_value self);
static mrb_value rb_KernAux_Version_supports_printfQN(mrb_state *mrb, mrb_value self); static mrb_value rb_KernAux_Version_with_printfQN(mrb_state *mrb, mrb_value self);
void init_version(mrb_state *const mrb) void init_version(mrb_state *const mrb)
{ {
@ -13,35 +13,35 @@ void init_version(mrb_state *const mrb)
struct RClass *const rb_KernAux_Version = struct RClass *const rb_KernAux_Version =
mrb_define_module_under_id(mrb, rb_KernAux, MRB_SYM(Version)); mrb_define_module_under_id(mrb, rb_KernAux, MRB_SYM(Version));
mrb_define_class_method(mrb, rb_KernAux_Version, "supports_cmdline?", mrb_define_class_method(mrb, rb_KernAux_Version, "with_cmdline?",
rb_KernAux_Version_supports_cmdlineQN, MRB_ARGS_REQ(0)); rb_KernAux_Version_with_cmdlineQN, MRB_ARGS_REQ(0));
mrb_define_class_method(mrb, rb_KernAux_Version, "supports_ntoa?", mrb_define_class_method(mrb, rb_KernAux_Version, "with_ntoa?",
rb_KernAux_Version_supports_ntoaQN, MRB_ARGS_REQ(0)); rb_KernAux_Version_with_ntoaQN, MRB_ARGS_REQ(0));
mrb_define_class_method(mrb, rb_KernAux_Version, "supports_printf?", mrb_define_class_method(mrb, rb_KernAux_Version, "with_printf?",
rb_KernAux_Version_supports_printfQN, MRB_ARGS_REQ(0)); rb_KernAux_Version_with_printfQN, MRB_ARGS_REQ(0));
} }
mrb_value rb_KernAux_Version_supports_cmdlineQN(mrb_state *const mrb, const mrb_value self) mrb_value rb_KernAux_Version_with_cmdlineQN(mrb_state *const mrb, const mrb_value self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
return mrb_true_value(); return mrb_true_value();
#else #else
return mrb_false_value(); return mrb_false_value();
#endif #endif
} }
mrb_value rb_KernAux_Version_supports_ntoaQN(mrb_state *const mrb, const mrb_value self) mrb_value rb_KernAux_Version_with_ntoaQN(mrb_state *const mrb, const mrb_value self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
return mrb_true_value(); return mrb_true_value();
#else #else
return mrb_false_value(); return mrb_false_value();
#endif #endif
} }
mrb_value rb_KernAux_Version_supports_printfQN(mrb_state *const mrb, const mrb_value self) mrb_value rb_KernAux_Version_with_printfQN(mrb_state *const mrb, const mrb_value self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
return mrb_true_value(); return mrb_true_value();
#else #else
return mrb_false_value(); return mrb_false_value();

View file

@ -11,7 +11,7 @@ def test_cmdline(str, expected)
assert_equal result, expected assert_equal result, expected
end end
if KernAux::Version.supports_cmdline? if KernAux::Version.with_cmdline?
assert 'default' do assert 'default' do
test_cmdline 'foo bar\\ baz "car cdr"', ['foo', 'bar baz', 'car cdr'] test_cmdline 'foo bar\\ baz "car cdr"', ['foo', 'bar baz', 'car cdr']
end end

View file

@ -56,7 +56,7 @@ def test_itoa16(number, expected)
common_assert expected, KernAux.itoa16(number) common_assert expected, KernAux.itoa16(number)
end end
if KernAux::Version.supports_ntoa? if KernAux::Version.with_ntoa?
assert 'KernAux.utoa' do assert 'KernAux.utoa' do
number = Random.rand(2**32 - 1) number = Random.rand(2**32 - 1)
base = 2 + Random.rand(36 - 2) base = 2 + Random.rand(36 - 2)

View file

@ -1,7 +1,7 @@
# TODO: implement this # TODO: implement this
# rubocop:disable Style/BlockComments # rubocop:disable Style/BlockComments
=begin =begin
if KernAux::Version.supports_printf? if KernAux::Version.with_printf?
assert 'KernAux.sprintf' do assert 'KernAux.sprintf' do
[ [
['', 'using regular tests'], ['', 'using regular tests'],

View file

@ -1,6 +1,6 @@
#include "main.h" #include "main.h"
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
#define ARGV_COUNT_MAX 256 #define ARGV_COUNT_MAX 256
#define BUFFER_SIZE 4096 #define BUFFER_SIZE 4096
@ -91,4 +91,4 @@ VALUE rb_KernAux_cmdline(const VALUE self_rb, VALUE cmdline_rb)
return rb_funcall(result_rb, rb_intern_freeze, 0); return rb_funcall(result_rb, rb_intern_freeze, 0);
} }
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE

View file

@ -1,6 +1,6 @@
#include "main.h" #include "main.h"
#ifdef KERNAUX_VERSION_SUPPORTS_FILE #ifdef KERNAUX_VERSION_WITH_FILE
static VALUE rb_KernAux_File_initialize(VALUE self, VALUE out); static VALUE rb_KernAux_File_initialize(VALUE self, VALUE out);
@ -26,4 +26,4 @@ VALUE rb_KernAux_File_initialize(VALUE self, VALUE out)
return Qnil; return Qnil;
} }
#endif // KERNAUX_VERSION_SUPPORTS_FILE #endif // KERNAUX_VERSION_WITH_FILE

View file

@ -5,16 +5,16 @@ void Init_default()
init_version(); init_version();
init_assert(); init_assert();
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
init_cmdline(); init_cmdline();
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE
#ifdef KERNAUX_VERSION_SUPPORTS_FILE #ifdef KERNAUX_VERSION_WITH_FILE
init_file(); init_file();
#endif // KERNAUX_VERSION_SUPPORTS_FILE #endif // KERNAUX_VERSION_WITH_FILE
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
init_ntoa(); init_ntoa();
#endif // KERNAUX_VERSION_SUPPORTS_NTOA #endif // KERNAUX_VERSION_WITH_NTOA
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
init_printf(); init_printf();
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF #endif // KERNAUX_VERSION_WITH_PRINTF
} }

View file

@ -7,17 +7,17 @@
void init_version(); void init_version();
void init_assert(); void init_assert();
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
void init_cmdline(); void init_cmdline();
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE
#ifdef KERNAUX_VERSION_SUPPORTS_FILE #ifdef KERNAUX_VERSION_WITH_FILE
void init_file(); void init_file();
#endif // KERNAUX_VERSION_SUPPORTS_FILE #endif // KERNAUX_VERSION_WITH_FILE
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
void init_ntoa(); void init_ntoa();
#endif // KERNAUX_VERSION_SUPPORTS_NTOA #endif // KERNAUX_VERSION_WITH_NTOA
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
void init_printf(); void init_printf();
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF #endif // KERNAUX_VERSION_WITH_PRINTF
#endif #endif

View file

@ -1,6 +1,6 @@
#include "main.h" #include "main.h"
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
static VALUE rb_KernAux_utoa(int argc, const VALUE *argv, VALUE self); static VALUE rb_KernAux_utoa(int argc, const VALUE *argv, VALUE self);
static VALUE rb_KernAux_itoa(int argc, const VALUE *argv, VALUE self); static VALUE rb_KernAux_itoa(int argc, const VALUE *argv, VALUE self);
@ -259,4 +259,4 @@ int convert_base(const VALUE base_rb)
} }
} }
#endif // KERNAUX_VERSION_SUPPORTS_NTOA #endif // KERNAUX_VERSION_WITH_NTOA

View file

@ -2,7 +2,7 @@
#include "dynarg.h" #include "dynarg.h"
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
static VALUE rb_KernAux_snprintf1(int argc, const VALUE *argv, VALUE self); static VALUE rb_KernAux_snprintf1(int argc, const VALUE *argv, VALUE self);
@ -115,4 +115,4 @@ VALUE rb_KernAux_snprintf1(
return rb_funcall(result_rb, rb_intern_freeze, 0); return rb_funcall(result_rb, rb_intern_freeze, 0);
} }
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF #endif // KERNAUX_VERSION_WITH_PRINTF

View file

@ -1,9 +1,9 @@
#include "main.h" #include "main.h"
static VALUE rb_KernAux_Version_supports_cmdlineQN(VALUE self); static VALUE rb_KernAux_Version_with_cmdlineQN(VALUE self);
static VALUE rb_KernAux_Version_supports_fileQN(VALUE self); static VALUE rb_KernAux_Version_with_fileQN(VALUE self);
static VALUE rb_KernAux_Version_supports_ntoaQN(VALUE self); static VALUE rb_KernAux_Version_with_ntoaQN(VALUE self);
static VALUE rb_KernAux_Version_supports_printfQN(VALUE self); static VALUE rb_KernAux_Version_with_printfQN(VALUE self);
static VALUE rb_KernAux = Qnil; static VALUE rb_KernAux = Qnil;
static VALUE rb_KernAux_Version = Qnil; static VALUE rb_KernAux_Version = Qnil;
@ -14,46 +14,46 @@ void init_version()
rb_gc_register_mark_object(rb_KernAux_Version = rb_gc_register_mark_object(rb_KernAux_Version =
rb_define_module_under(rb_KernAux, "Version")); rb_define_module_under(rb_KernAux, "Version"));
rb_define_singleton_method(rb_KernAux_Version, "supports_cmdline?", rb_define_singleton_method(rb_KernAux_Version, "with_cmdline?",
rb_KernAux_Version_supports_cmdlineQN, 0); rb_KernAux_Version_with_cmdlineQN, 0);
rb_define_singleton_method(rb_KernAux_Version, "supports_file?", rb_define_singleton_method(rb_KernAux_Version, "with_file?",
rb_KernAux_Version_supports_fileQN, 0); rb_KernAux_Version_with_fileQN, 0);
rb_define_singleton_method(rb_KernAux_Version, "supports_ntoa?", rb_define_singleton_method(rb_KernAux_Version, "with_ntoa?",
rb_KernAux_Version_supports_ntoaQN, 0); rb_KernAux_Version_with_ntoaQN, 0);
rb_define_singleton_method(rb_KernAux_Version, "supports_printf?", rb_define_singleton_method(rb_KernAux_Version, "with_printf?",
rb_KernAux_Version_supports_printfQN, 0); rb_KernAux_Version_with_printfQN, 0);
} }
VALUE rb_KernAux_Version_supports_cmdlineQN(VALUE self) VALUE rb_KernAux_Version_with_cmdlineQN(VALUE self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
return Qtrue; return Qtrue;
#else #else
return Qfalse; return Qfalse;
#endif #endif
} }
VALUE rb_KernAux_Version_supports_fileQN(VALUE self) VALUE rb_KernAux_Version_with_fileQN(VALUE self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_FILE #ifdef KERNAUX_VERSION_WITH_FILE
return Qtrue; return Qtrue;
#else #else
return Qfalse; return Qfalse;
#endif #endif
} }
VALUE rb_KernAux_Version_supports_ntoaQN(VALUE self) VALUE rb_KernAux_Version_with_ntoaQN(VALUE self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
return Qtrue; return Qtrue;
#else #else
return Qfalse; return Qfalse;
#endif #endif
} }
VALUE rb_KernAux_Version_supports_printfQN(VALUE self) VALUE rb_KernAux_Version_with_printfQN(VALUE self)
{ {
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF #ifdef KERNAUX_VERSION_WITH_PRINTF
return Qtrue; return Qtrue;
#else #else
return Qfalse; return Qfalse;

View file

@ -2,7 +2,7 @@
# rubocop:disable Lint/EmptyClass # rubocop:disable Lint/EmptyClass
if KernAux::Version.supports_file? if KernAux::Version.with_file?
module KernAux module KernAux
## ##
# File simulator. # File simulator.

View file

@ -12,7 +12,7 @@ module KernAux
# @!parse [ruby] # @!parse [ruby]
if Version.supports_printf? if Version.with_printf?
## ##
# Typical `printf`. # Typical `printf`.
# #

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_cmdline? and RSpec.describe KernAux, '.cmdline' do KernAux::Version.with_cmdline? and RSpec.describe KernAux, '.cmdline' do
subject(:cmdline) { described_class.cmdline str } subject(:cmdline) { described_class.cmdline str }
let(:str) { 'foo bar\\ baz "car cdr"' } let(:str) { 'foo bar\\ baz "car cdr"' }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.itoa10' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.itoa10' do
subject(:itoa10) { described_class.itoa10 number } subject(:itoa10) { described_class.itoa10 number }
let(:number) { rand((-2**63)..(2**63 - 1)) } let(:number) { rand((-2**63)..(2**63 - 1)) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.itoa16' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.itoa16' do
subject(:itoa16) { described_class.itoa16 number } subject(:itoa16) { described_class.itoa16 number }
let(:number) { rand((-2**63)..(2**63 - 1)) } let(:number) { rand((-2**63)..(2**63 - 1)) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.itoa2' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.itoa2' do
subject(:itoa2) { described_class.itoa2 number } subject(:itoa2) { described_class.itoa2 number }
let(:number) { rand((-2**63)..(2**63 - 1)) } let(:number) { rand((-2**63)..(2**63 - 1)) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.itoa8' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.itoa8' do
subject(:itoa8) { described_class.itoa8 number } subject(:itoa8) { described_class.itoa8 number }
let(:number) { rand((-2**63)..(2**63 - 1)) } let(:number) { rand((-2**63)..(2**63 - 1)) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.itoa' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.itoa' do
subject(:itoa) { described_class.itoa number, base, prefix } subject(:itoa) { described_class.itoa number, base, prefix }
let(:number) { rand((-2**63)..(2**63 - 1)) } let(:number) { rand((-2**63)..(2**63 - 1)) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.utoa10' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.utoa10' do
subject(:utoa10) { described_class.utoa10 number } subject(:utoa10) { described_class.utoa10 number }
let(:number) { rand 0..(2**64 - 1) } let(:number) { rand 0..(2**64 - 1) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.utoa16' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.utoa16' do
subject(:utoa16) { described_class.utoa16 number } subject(:utoa16) { described_class.utoa16 number }
let(:number) { rand 0..(2**64 - 1) } let(:number) { rand 0..(2**64 - 1) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.utoa2' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.utoa2' do
subject(:utoa2) { described_class.utoa2 number } subject(:utoa2) { described_class.utoa2 number }
let(:number) { rand 0..(2**64 - 1) } let(:number) { rand 0..(2**64 - 1) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.utoa8' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.utoa8' do
subject(:utoa8) { described_class.utoa8 number } subject(:utoa8) { described_class.utoa8 number }
let(:number) { rand 0..(2**64 - 1) } let(:number) { rand 0..(2**64 - 1) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_ntoa? and RSpec.describe KernAux, '.utoa' do KernAux::Version.with_ntoa? and RSpec.describe KernAux, '.utoa' do
subject(:utoa) { described_class.utoa number, base, prefix } subject(:utoa) { described_class.utoa number, base, prefix }
let(:number) { rand 0..(2**64 - 1) } let(:number) { rand 0..(2**64 - 1) }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_printf? and RSpec.describe KernAux, '.snprintf1' do KernAux::Version.with_printf? and RSpec.describe KernAux, '.snprintf1' do
let(:size) { 10_000 } let(:size) { 10_000 }
context 'with 0 arguments' do context 'with 0 arguments' do

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_printf? and RSpec.describe KernAux, '.sprintf1' do KernAux::Version.with_printf? and RSpec.describe KernAux, '.sprintf1' do
context 'with 1 argument' do context 'with 1 argument' do
subject(:sprintf1) { described_class.sprintf1 format } subject(:sprintf1) { described_class.sprintf1 format }

View file

@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
KernAux::Version.supports_printf? and RSpec.describe KernAux, '.sprintf' do KernAux::Version.with_printf? and RSpec.describe KernAux, '.sprintf' do
subject :sprintf do subject :sprintf do
described_class.sprintf 'Hello, ', ['%s', 'World'], '!' described_class.sprintf 'Hello, ', ['%s', 'World'], '!'
end end

View file

@ -1,7 +1,7 @@
pub fn supports_cmdline() -> bool { pub fn with_cmdline() -> bool {
cfg!(feature = "cmdline") cfg!(feature = "cmdline")
} }
pub fn supports_ntoa() -> bool { pub fn with_ntoa() -> bool {
cfg!(feature = "ntoa") cfg!(feature = "ntoa")
} }

View file

@ -1,17 +1,17 @@
#ifndef KERNAUX_INCLUDED_VERSION #ifndef KERNAUX_INCLUDED_VERSION
#define KERNAUX_INCLUDED_VERSION #define KERNAUX_INCLUDED_VERSION
@comment_line_cmdline@#define KERNAUX_VERSION_SUPPORTS_CMDLINE @comment_line_cmdline@#define KERNAUX_VERSION_WITH_CMDLINE
@comment_line_console@#define KERNAUX_VERSION_SUPPORTS_CONSOLE @comment_line_console@#define KERNAUX_VERSION_WITH_CONSOLE
@comment_line_elf@#define KERNAUX_VERSION_SUPPORTS_ELF @comment_line_elf@#define KERNAUX_VERSION_WITH_ELF
@comment_line_file@#define KERNAUX_VERSION_SUPPORTS_FILE @comment_line_file@#define KERNAUX_VERSION_WITH_FILE
@comment_line_framebuffer@#define KERNAUX_VERSION_SUPPORTS_FRAMEBUFFER @comment_line_framebuffer@#define KERNAUX_VERSION_WITH_FRAMEBUFFER
@comment_line_mbr@#define KERNAUX_VERSION_SUPPORTS_MBR @comment_line_mbr@#define KERNAUX_VERSION_WITH_MBR
@comment_line_multiboot2@#define KERNAUX_VERSION_SUPPORTS_MULTIBOOT2 @comment_line_multiboot2@#define KERNAUX_VERSION_WITH_MULTIBOOT2
@comment_line_ntoa@#define KERNAUX_VERSION_SUPPORTS_NTOA @comment_line_ntoa@#define KERNAUX_VERSION_WITH_NTOA
@comment_line_pfa@#define KERNAUX_VERSION_SUPPORTS_PFA @comment_line_pfa@#define KERNAUX_VERSION_WITH_PFA
@comment_line_printf@#define KERNAUX_VERSION_SUPPORTS_PRINTF @comment_line_printf@#define KERNAUX_VERSION_WITH_PRINTF
@comment_line_printf_fmt@#define KERNAUX_VERSION_SUPPORTS_PRINTF_FMT @comment_line_printf_fmt@#define KERNAUX_VERSION_WITH_PRINTF_FMT
@comment_line_units@#define KERNAUX_VERSION_SUPPORTS_UNITS @comment_line_units@#define KERNAUX_VERSION_WITH_UNITS
#endif #endif