/* notes_tests.pl Author: Gimenez, Christian. Copyright (C) 2025 Gimenez, Christian This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . 2025-10-12 */ :- module(notes_tests, [ ]). /** notes_tests: @author Christian Gimenez @license GPLv3 */ :- license(gplv3). :- use_module(library(music/notes)). :- begin_tests(notes, []). test(notenum_simple) :- notenum(c, 0), notenum(cs, 1), notenum(d, 2), notenum(ds, 3), notenum(e, 4), notenum(f, 5), notenum(fs, 6), notenum(g, 7), notenum(gs, 8), notenum(a, 9), notenum(as, 10), notenum(b, 11). test(notenum_cyclic) :- notenum(c, 12), notenum(cs, 13), notenum(d, 14), notenum(ds, 15). test(notenum_cyclic_error, [fail]) :- notenum(d, 12). test(notenum_negative) :- notenum(b, -1), notenum(as, -2), notenum(a, -3), notenum(c, -12). test(sum_semitones_simple) :- sum_semitones(c, 2, R1), R1 = d, sum_semitones(d, 2, R2), R2 = e, sum_semitones(e, 2, R3), R3 = fs, sum_semitones(f, 2, R4), R4 = g, sum_semitones(g, 2, R5), R5 = a, sum_semitones(a, 2, R6), R6 = b. test(sum_semitones_cyclic) :- sum_semitones(b, 2, R), R = cs. test(sum_semitones_negative) :- sum_semitones(c, -2, R), R = as. test(sum_semitones_with_octave) :- sum_semitones(b-1, 1, R), R = c-2. :- end_tests(notes).