Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/R.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ jobs:
env:
NOT_CRAN: false
run: |
coverage <- covr::package_coverage(type="all", quiet=FALSE, clean = FALSE,
coverage <- withr::with_makevars(c(MOOCORE_DEBUG="1", LTO_OPT=""),
covr::package_coverage(type="all", quiet=FALSE, clean = FALSE,
commentDonttest = FALSE, commentDontrun = FALSE, flags="R",
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"))
)
print(coverage)
covr::to_cobertura(coverage)
list.files("../", pattern="*.xml", recursive=TRUE)
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ repos:
- id: tox-ini-fmt

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.11.0"
rev: "v2.11.1"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.12.1"]

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.3
rev: v0.14.7
hooks:
# Run the formatter.
- id: ruff-format
Expand All @@ -68,6 +68,6 @@ repos:
require_serial: true

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.1
rev: v1.0.2
hooks:
- id: sphinx-lint
2 changes: 1 addition & 1 deletion c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ $(CXXSHLIB): $(LIBHV_OBJS)
$(CXX) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(SHLIB_LDFLAGS)

clean:
@-$(RM) *.s *.i
@-$(RM) *.s *.i *.gcda mt19937/*.gcda
@-$(RM) config.status config.log
@-$(RM) Hypervolume_MEX.mex
@-$(RM) $(SHLIB) $(CXXSHLIB)
Expand Down
2 changes: 1 addition & 1 deletion c/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static inline void default_cmdline_handler(int opt)
usage();
exit(EXIT_SUCCESS);
default:
unreachable();
unreachable(); // COVR_EXCL_LINE # nocov
}
}

Expand Down
12 changes: 6 additions & 6 deletions c/gcc_attribs.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@


#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__clang__)
# define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0)
# define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0)
#elif (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
# define likely(x) (x) [[likely]]
# define unlikely(x) (x) [[unlikely]]
# define likely(x) (x) [[likely]]
# define unlikely(x) (x) [[unlikely]]
#else
# define likely(x) (x)
# define unlikely(x) (x)
# define likely(x) (x)
# define unlikely(x) (x)
#endif

#ifdef _MSC_VER
Expand Down
4 changes: 2 additions & 2 deletions c/hv4d_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ restart_base_setup_z_and_closest(dlnode_t * restrict list, dlnode_t * restrict n
}
p = p->next[0];
}
unreachable();
unreachable(); // COVR_EXCL_LINE # nocov
}

// FIXME: This is very similar to the loop in hvc3d_list() but it doesn't use p->last_slice_z
Expand Down Expand Up @@ -211,7 +211,7 @@ one_contribution_3d(dlnode_t * restrict newp)
lastz = px[2];
p = p->next[0];
}
unreachable();
unreachable(); // COVR_EXCL_LINE # nocov
}

/* Compute the hypervolume indicator in d=4 by iteratively computing the one
Expand Down
2 changes: 1 addition & 1 deletion c/hvapprox.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ int_of_power_of_sin_from_0_to_b(dimension_t m, double b)
return 0.13994993409141898*b - cos_b*sin_b*(
0.03125*POW(sin_b, 30) + 31/960.*POW(sin_b, 28) + 899/26880.*POW(sin_b, 26) + 8091/232960.*POW(sin_b, 24) + 13485/372736.*POW(sin_b, 22) + 310155/8200192.*POW(sin_b, 20) + 186093/4685824.*POW(sin_b, 18) + 392863/9371648.*POW(sin_b, 16) + 6678671/149946368.*POW(sin_b, 14) + 100180065/2099249152.*POW(sin_b, 12) + 33393355/645922816.*POW(sin_b, 10) + 6678671/117440512.*POW(sin_b, 8) + 60108039/939524096.*POW(sin_b, 6) + 0.07463996484875679*POW(sin_b, 4) + 0.093299956060945988*POW(sin_b, 2) + 0.13994993409141898);
default:
unreachable();
unreachable(); // COVR_EXCL_LINE # nocov
}
#undef POW
}
Expand Down
2 changes: 1 addition & 1 deletion c/main-hvapprox.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ hvapprox_file (const char *filename, double *reference,
volume = hv_approx_hua_wang(&data[nobj * cumsize], nobj, cumsizes[n] - cumsize, reference, maximise, nsamples);
break;
default:
unreachable();
unreachable(); // COVR_EXCL_LINE # nocov
}

if (volume == 0.0) {
Expand Down
4 changes: 2 additions & 2 deletions c/nondominated.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ find_dominated_point_(const double * restrict points, dimension_t dim, size_t si
return find_dominated_point_agree_(
points, dim, size, keep_weakly, AGREE_MAXIMISE, /*minmax=*/NULL);
default:
unreachable();
unreachable(); // # nocov
}
}

Expand Down Expand Up @@ -525,7 +525,7 @@ find_nondominated_set_(const double * restrict points, dimension_t dim, size_t s
return find_nondominated_set_agree_(
points, dim, size, nondom, keep_weakly, AGREE_MAXIMISE, /*minmax=*/NULL);
default:
unreachable();
unreachable(); // # nocov
}
}

Expand Down
4 changes: 2 additions & 2 deletions c/pow_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fast_pow_uint_max32(double base, uint_fast8_t exp)
case 30: { b15 = fast_pow_uint_max32(base, 15); return b15 * b15; }
case 31: { b15 = fast_pow_uint_max32(base, 15); return b15 * b15 * base; }
case 32: { b16 = fast_pow_uint_max32(base, 16); return b16 * b16; }
default: unreachable();
default: unreachable(); // COVR_EXCL_LINE # nocov
}
}

Expand Down Expand Up @@ -103,7 +103,7 @@ fast_powl_uint_max32(long double base, uint_fast8_t exp)
case 30: { b15 = fast_powl_uint_max32(base, 15); return b15 * b15; }
case 31: { b15 = fast_powl_uint_max32(base, 15); return b15 * b15 * base; }
case 32: { b16 = fast_powl_uint_max32(base, 16); return b16 * b16; }
default: unreachable();
default: unreachable(); // COVR_EXCL_LINE # nocov
}
}

Expand Down
5 changes: 5 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ faulthandler_timeout = 10
doctest_optionflags = "NUMBER"
addopts = [ "--import-mode=importlib", "--durations=5", "--durations-min=1.0" ]

[tool.coverage.report]
exclude_also = [
'# nocov',
]

[tool.mypy]
python_version = "3.11"
# Strictness (recommended for library code)
Expand Down
3 changes: 2 additions & 1 deletion python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ commands =
coverage run --source={envsitepackagesdir}/moocore,tests -m pytest --doctest-modules --import-mode=importlib {envsitepackagesdir}/moocore tests
coverage report -m
coverage xml
gcovr --print-summary --delete -r {toxinidir} {toxinidir} --xml=c_coverage.xml --exclude '.*/moocore\._libmoocore.c' --fail-under-line 1
gcovr --exclude-unreachable-branches --print-summary --delete -r {toxinidir} {toxinidir} --xml=c_coverage.xml --exclude '.*/moocore\._libmoocore.c' --fail-under-line 1

[testenv:docs]
description = Build documentation
Expand All @@ -55,6 +55,7 @@ passenv = MOOCORE_DEBUG
setenv =
.pkg-cov: CFLAGS={env:CFLAGS:--coverage -UNDEBUG -DDEBUG=1}
.pkg-cov: LDFLAGS=--coverage
.pkg-cov: MOOCORE_DEBUG=1
.pkg-release: MOOCORE_DEBUG=0
.pkg-debug: MOOCORE_DEBUG=1

Expand Down
4 changes: 2 additions & 2 deletions r/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ check: build
ifdef TEST
_R_CHECK_FORCE_SUGGESTS_=false NOT_CRAN=true $(Reval) 'devtools::test(filter="$(TEST)")'
else
cd $(BINDIR) && (_R_CHECK_FORCE_SUGGESTS_=false NOT_CRAN=true DEBUG=1 R CMD check --run-donttest --run-dontrun --timings $(PACKAGE)_$(PACKAGEVERSION).tar.gz; cat $(PACKAGE).Rcheck/$(PACKAGE)-Ex.timings)
cd $(BINDIR) && (_R_CHECK_FORCE_SUGGESTS_=false NOT_CRAN=true MOOCORE_DEBUG=1 R CMD check --run-donttest --run-dontrun --timings $(PACKAGE)_$(PACKAGEVERSION).tar.gz; cat $(PACKAGE).Rcheck/$(PACKAGE)-Ex.timings)
endif

show:
Expand All @@ -112,7 +112,7 @@ winbuild winbuild_:
$(Reval) "devtools::check_win_devel()"

covr:
$(Reval) "Sys.setenv(NOT_CRAN='true');covr::report(covr::package_coverage(type='all', quiet=FALSE), browse=TRUE)"
$(Reval) "Sys.setenv(NOT_CRAN='true');covr::report(withr::with_makevars(c(MOOCORE_DEBUG='1', LTO_OPT=''), covr::package_coverage(type='all', commentDonttest=FALSE, commentDontrun=FALSE, quiet=FALSE)), browse=TRUE)"

benchmarks: quick-install
$(RM) ./vignettes/articles/bench/*.rds
Expand Down
6 changes: 3 additions & 3 deletions r/src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# In particular, add the following to ~/.R/Makevars:
# LTO_OPT=-flto
LTO=$(LTO_OPT)
DEBUG=0
PKG_CPPFLAGS=-DR_PACKAGE -DDEBUG=$(DEBUG) -I./libmoocore/
MOOCORE_DEBUG?=0
PKG_CPPFLAGS=-DR_PACKAGE -DDEBUG=$(MOOCORE_DEBUG) -I./libmoocore/

MOOCORE_SRC_FILES = hv3dplus.c hv4d.c hv_contrib.c hv.c hvapprox.c hvc3d.c pareto.c whv.c whv_hype.c avl.c eaf3d.c eaf.c io.c rng.c mt19937/mt19937.c
SOURCES = $(MOOCORE_SRC_FILES:%=libmoocore/%) init.c Rmoocore.c
Expand All @@ -19,7 +19,7 @@ all: exes $(SHLIB)
$(SHLIB): $(OBJECTS)

exes: $(SHLIB)
$(MAKE) -C libmoocore all march=none CC="$(CC)" CFLAGS="$(CFLAGS)" WARN_CFLAGS="" OPT_CFLAGS="" DEBUG=$(DEBUG) EXE=$(EXEEXT) BINDIR=$(PWD)
$(MAKE) -C libmoocore all march=none CC="$(CC)" CFLAGS="$(CFLAGS)" WARN_CFLAGS="" OPT_CFLAGS="" DEBUG=$(MOOCORE_DEBUG) EXE=$(EXEEXT) BINDIR=$(PWD)
@-$(RM) libmoocore/*.o

clean:
Expand Down