#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2024 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0

import vltest_bootstrap

test.scenarios('simulator')

test.compile(verilator_flags2=['-fno-gate'])

test.execute(expect_filename=test.golden_filename)

# Check for coverage on all POW functions
os.system("cat " + test.obj_dir + "/" + test.vm_prefix + "_*.cpp > " + test.obj_dir + "/all.cpp")

test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_III')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_IIQ')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_IIW')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_QQI')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_QQQ')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_QQW')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_WWI')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_WWQ')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POW_WWW')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_III')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_IIQ')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_IIW')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_QQI')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_QQQ')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_QQW')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_WWI')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_WWQ')
test.file_grep(test.obj_dir + "/all.cpp", r'VL_POWSS_WWW')

test.passes()
