#!/usr/bin/env -S bats --report-formatter junit --formatter tap -j 2
# -*-sh-*-

load ../../common/test_helper_functions || exit 1
source ../../common/functions || exit 1

@test "[Compilers] debugger man page (${LMOD_FAMILY_COMPILER})" {
	if [ "${LMOD_FAMILY_COMPILER}" = "gnu" ]; then
		run man -w gdb
		assert_success
	elif [ "${LMOD_FAMILY_COMPILER}" = "intel" ]; then
		module load debugger
		run man -w gdb-oneapi
		assert_success
	fi
}

@test "[Compilers] debugger availability (${LMOD_FAMILY_COMPILER})" {
	if [ "${LMOD_FAMILY_COMPILER}" = "gnu" ]; then
		run which gdb
		assert_success

		run gdb --version
		assert_success
	elif [ "${LMOD_FAMILY_COMPILER}" = "intel" ]; then
		module load debugger
		run which gdb-oneapi
		assert_success

		run gdb-oneapi --version
		assert_success
	fi
}
