mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-27 11:14:42 -05:00
Common: improve feature macros (#53)
This commit is contained in:
parent
940f981ef1
commit
42d626f868
35 changed files with 111 additions and 111 deletions
|
@ -9,7 +9,7 @@ module KernAux
|
|||
|
||||
SPRINTF1_BUFFER_SIZE = 10_000
|
||||
|
||||
if Version.supports_printf?
|
||||
if Version.with_printf?
|
||||
def self.sprintf(*args)
|
||||
args.map do |arg|
|
||||
if arg.is_a? Array
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define ARGV_COUNT_MAX 256
|
||||
#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);
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#endif // KERNAUX_VERSION_WITH_CMDLINE
|
||||
|
|
|
@ -26,15 +26,15 @@ void mrb_mruby_kernaux_gem_init(mrb_state *const mrb)
|
|||
init_assert(mrb);
|
||||
init_version(mrb);
|
||||
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_CMDLINE
|
||||
init_cmdline(mrb);
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#endif // KERNAUX_VERSION_WITH_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_NTOA
|
||||
init_ntoa(mrb);
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_NTOA
|
||||
#ifdef KERNAUX_VERSION_WITH_PRINTF
|
||||
init_printf(mrb);
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_PRINTF
|
||||
}
|
||||
|
||||
void current_mrb_start(mrb_state *mrb)
|
||||
|
|
|
@ -11,14 +11,14 @@ mrb_state *current_mrb_get();
|
|||
void init_assert(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);
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#endif // KERNAUX_VERSION_WITH_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_NTOA
|
||||
void init_ntoa(mrb_state *mrb);
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_NTOA
|
||||
#ifdef KERNAUX_VERSION_WITH_PRINTF
|
||||
void init_printf(mrb_state *mrb);
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_PRINTF
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <mruby/presym.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_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
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <mruby/presym.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);
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_PRINTF
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#include <mruby/presym.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_supports_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_cmdlineQN(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_with_printfQN(mrb_state *mrb, mrb_value self);
|
||||
|
||||
void init_version(mrb_state *const mrb)
|
||||
{
|
||||
|
@ -13,35 +13,35 @@ void init_version(mrb_state *const mrb)
|
|||
struct RClass *const rb_KernAux_Version =
|
||||
mrb_define_module_under_id(mrb, rb_KernAux, MRB_SYM(Version));
|
||||
|
||||
mrb_define_class_method(mrb, rb_KernAux_Version, "supports_cmdline?",
|
||||
rb_KernAux_Version_supports_cmdlineQN, MRB_ARGS_REQ(0));
|
||||
mrb_define_class_method(mrb, rb_KernAux_Version, "supports_ntoa?",
|
||||
rb_KernAux_Version_supports_ntoaQN, MRB_ARGS_REQ(0));
|
||||
mrb_define_class_method(mrb, rb_KernAux_Version, "supports_printf?",
|
||||
rb_KernAux_Version_supports_printfQN, MRB_ARGS_REQ(0));
|
||||
mrb_define_class_method(mrb, rb_KernAux_Version, "with_cmdline?",
|
||||
rb_KernAux_Version_with_cmdlineQN, MRB_ARGS_REQ(0));
|
||||
mrb_define_class_method(mrb, rb_KernAux_Version, "with_ntoa?",
|
||||
rb_KernAux_Version_with_ntoaQN, MRB_ARGS_REQ(0));
|
||||
mrb_define_class_method(mrb, rb_KernAux_Version, "with_printf?",
|
||||
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();
|
||||
#else
|
||||
return mrb_false_value();
|
||||
#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();
|
||||
#else
|
||||
return mrb_false_value();
|
||||
#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();
|
||||
#else
|
||||
return mrb_false_value();
|
||||
|
|
|
@ -11,7 +11,7 @@ def test_cmdline(str, expected)
|
|||
assert_equal result, expected
|
||||
end
|
||||
|
||||
if KernAux::Version.supports_cmdline?
|
||||
if KernAux::Version.with_cmdline?
|
||||
assert 'default' do
|
||||
test_cmdline 'foo bar\\ baz "car cdr"', ['foo', 'bar baz', 'car cdr']
|
||||
end
|
||||
|
|
|
@ -56,7 +56,7 @@ def test_itoa16(number, expected)
|
|||
common_assert expected, KernAux.itoa16(number)
|
||||
end
|
||||
|
||||
if KernAux::Version.supports_ntoa?
|
||||
if KernAux::Version.with_ntoa?
|
||||
assert 'KernAux.utoa' do
|
||||
number = Random.rand(2**32 - 1)
|
||||
base = 2 + Random.rand(36 - 2)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# TODO: implement this
|
||||
# rubocop:disable Style/BlockComments
|
||||
=begin
|
||||
if KernAux::Version.supports_printf?
|
||||
if KernAux::Version.with_printf?
|
||||
assert 'KernAux.sprintf' do
|
||||
[
|
||||
['', 'using regular tests'],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "main.h"
|
||||
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_CMDLINE
|
||||
|
||||
#define ARGV_COUNT_MAX 256
|
||||
#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);
|
||||
}
|
||||
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#endif // KERNAUX_VERSION_WITH_CMDLINE
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "main.h"
|
||||
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_FILE
|
||||
#ifdef KERNAUX_VERSION_WITH_FILE
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_FILE
|
||||
#endif // KERNAUX_VERSION_WITH_FILE
|
||||
|
|
|
@ -5,16 +5,16 @@ void Init_default()
|
|||
init_version();
|
||||
init_assert();
|
||||
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_CMDLINE
|
||||
init_cmdline();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_FILE
|
||||
#endif // KERNAUX_VERSION_WITH_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_FILE
|
||||
init_file();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_FILE
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#endif // KERNAUX_VERSION_WITH_FILE
|
||||
#ifdef KERNAUX_VERSION_WITH_NTOA
|
||||
init_ntoa();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_NTOA
|
||||
#ifdef KERNAUX_VERSION_WITH_PRINTF
|
||||
init_printf();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_PRINTF
|
||||
}
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
void init_version();
|
||||
void init_assert();
|
||||
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_CMDLINE
|
||||
void init_cmdline();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_FILE
|
||||
#endif // KERNAUX_VERSION_WITH_CMDLINE
|
||||
#ifdef KERNAUX_VERSION_WITH_FILE
|
||||
void init_file();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_FILE
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#endif // KERNAUX_VERSION_WITH_FILE
|
||||
#ifdef KERNAUX_VERSION_WITH_NTOA
|
||||
void init_ntoa();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
#ifdef KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_NTOA
|
||||
#ifdef KERNAUX_VERSION_WITH_PRINTF
|
||||
void init_printf();
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_PRINTF
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#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_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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#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);
|
||||
|
||||
|
@ -115,4 +115,4 @@ VALUE rb_KernAux_snprintf1(
|
|||
return rb_funcall(result_rb, rb_intern_freeze, 0);
|
||||
}
|
||||
|
||||
#endif // KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
#endif // KERNAUX_VERSION_WITH_PRINTF
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "main.h"
|
||||
|
||||
static VALUE rb_KernAux_Version_supports_cmdlineQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_supports_fileQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_supports_ntoaQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_supports_printfQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_with_cmdlineQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_with_fileQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_with_ntoaQN(VALUE self);
|
||||
static VALUE rb_KernAux_Version_with_printfQN(VALUE self);
|
||||
|
||||
static VALUE rb_KernAux = Qnil;
|
||||
static VALUE rb_KernAux_Version = Qnil;
|
||||
|
@ -14,46 +14,46 @@ void init_version()
|
|||
rb_gc_register_mark_object(rb_KernAux_Version =
|
||||
rb_define_module_under(rb_KernAux, "Version"));
|
||||
|
||||
rb_define_singleton_method(rb_KernAux_Version, "supports_cmdline?",
|
||||
rb_KernAux_Version_supports_cmdlineQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "supports_file?",
|
||||
rb_KernAux_Version_supports_fileQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "supports_ntoa?",
|
||||
rb_KernAux_Version_supports_ntoaQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "supports_printf?",
|
||||
rb_KernAux_Version_supports_printfQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "with_cmdline?",
|
||||
rb_KernAux_Version_with_cmdlineQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "with_file?",
|
||||
rb_KernAux_Version_with_fileQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "with_ntoa?",
|
||||
rb_KernAux_Version_with_ntoaQN, 0);
|
||||
rb_define_singleton_method(rb_KernAux_Version, "with_printf?",
|
||||
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;
|
||||
#else
|
||||
return Qfalse;
|
||||
#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;
|
||||
#else
|
||||
return Qfalse;
|
||||
#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;
|
||||
#else
|
||||
return Qfalse;
|
||||
#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;
|
||||
#else
|
||||
return Qfalse;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# rubocop:disable Lint/EmptyClass
|
||||
|
||||
if KernAux::Version.supports_file?
|
||||
if KernAux::Version.with_file?
|
||||
module KernAux
|
||||
##
|
||||
# File simulator.
|
||||
|
|
|
@ -12,7 +12,7 @@ module KernAux
|
|||
|
||||
# @!parse [ruby]
|
||||
|
||||
if Version.supports_printf?
|
||||
if Version.with_printf?
|
||||
##
|
||||
# Typical `printf`.
|
||||
#
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:str) { 'foo bar\\ baz "car cdr"' }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand((-2**63)..(2**63 - 1)) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand((-2**63)..(2**63 - 1)) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand((-2**63)..(2**63 - 1)) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand((-2**63)..(2**63 - 1)) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand((-2**63)..(2**63 - 1)) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand 0..(2**64 - 1) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand 0..(2**64 - 1) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand 0..(2**64 - 1) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand 0..(2**64 - 1) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
let(:number) { rand 0..(2**64 - 1) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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 }
|
||||
|
||||
context 'with 0 arguments' do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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
|
||||
subject(:sprintf1) { described_class.sprintf1 format }
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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
|
||||
described_class.sprintf 'Hello, ', ['%s', 'World'], '!'
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pub fn supports_cmdline() -> bool {
|
||||
pub fn with_cmdline() -> bool {
|
||||
cfg!(feature = "cmdline")
|
||||
}
|
||||
|
||||
pub fn supports_ntoa() -> bool {
|
||||
pub fn with_ntoa() -> bool {
|
||||
cfg!(feature = "ntoa")
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#ifndef KERNAUX_INCLUDED_VERSION
|
||||
#define KERNAUX_INCLUDED_VERSION
|
||||
|
||||
@comment_line_cmdline@#define KERNAUX_VERSION_SUPPORTS_CMDLINE
|
||||
@comment_line_console@#define KERNAUX_VERSION_SUPPORTS_CONSOLE
|
||||
@comment_line_elf@#define KERNAUX_VERSION_SUPPORTS_ELF
|
||||
@comment_line_file@#define KERNAUX_VERSION_SUPPORTS_FILE
|
||||
@comment_line_framebuffer@#define KERNAUX_VERSION_SUPPORTS_FRAMEBUFFER
|
||||
@comment_line_mbr@#define KERNAUX_VERSION_SUPPORTS_MBR
|
||||
@comment_line_multiboot2@#define KERNAUX_VERSION_SUPPORTS_MULTIBOOT2
|
||||
@comment_line_ntoa@#define KERNAUX_VERSION_SUPPORTS_NTOA
|
||||
@comment_line_pfa@#define KERNAUX_VERSION_SUPPORTS_PFA
|
||||
@comment_line_printf@#define KERNAUX_VERSION_SUPPORTS_PRINTF
|
||||
@comment_line_printf_fmt@#define KERNAUX_VERSION_SUPPORTS_PRINTF_FMT
|
||||
@comment_line_units@#define KERNAUX_VERSION_SUPPORTS_UNITS
|
||||
@comment_line_cmdline@#define KERNAUX_VERSION_WITH_CMDLINE
|
||||
@comment_line_console@#define KERNAUX_VERSION_WITH_CONSOLE
|
||||
@comment_line_elf@#define KERNAUX_VERSION_WITH_ELF
|
||||
@comment_line_file@#define KERNAUX_VERSION_WITH_FILE
|
||||
@comment_line_framebuffer@#define KERNAUX_VERSION_WITH_FRAMEBUFFER
|
||||
@comment_line_mbr@#define KERNAUX_VERSION_WITH_MBR
|
||||
@comment_line_multiboot2@#define KERNAUX_VERSION_WITH_MULTIBOOT2
|
||||
@comment_line_ntoa@#define KERNAUX_VERSION_WITH_NTOA
|
||||
@comment_line_pfa@#define KERNAUX_VERSION_WITH_PFA
|
||||
@comment_line_printf@#define KERNAUX_VERSION_WITH_PRINTF
|
||||
@comment_line_printf_fmt@#define KERNAUX_VERSION_WITH_PRINTF_FMT
|
||||
@comment_line_units@#define KERNAUX_VERSION_WITH_UNITS
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue