%% Generated by lilypond-book
%% Options: [exampleindent=10.16\mm,indent=0\mm,line-width=160\mm,paper-height=845.047\pt,paper-width=597.508\pt,papersize='(cons (* 597.508 pt) (* 845.047 pt))]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************

#(ly:set-option 'eps-box-padding 3.000000)



\paper {
  #(set-paper-size '(cons (* 597.508 pt) (* 845.047 pt)))
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.000000) (* mm 1))
}

\layout {
  
}




% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "/lilypond-2.26.0/input/regression/other/beat-structure.ly"
\sourcefileline 0
\version "2.25.27"

\header {
  texidoc = "This is a set of tests of the @code{beat-structure} Scheme function
for single-fraction time signatures.  Problems are reported in the standard
error stream."
}

\include "testing-functions.ily"
#(ly:set-option 'warning-as-error #t)

#(expect-equal "signature not found in settings; default base"
  (beat-structure 1/4 '(4 . 4) '())
  '(1 1 1 1))
#(expect-equal "signature not found in settings; custom base"
  (beat-structure 1/8 '(4 . 4) '())
  '(2 2 2 2))
#(expect-equal "signature not found in settings; senza-misura base"
  (beat-structure +inf.0 '(4 . 4) '())
  '())
#(expect-equal "signature not found in settings; subdiv. w/ default base"
  (beat-structure 1/8 '((2 3) . 8) '())
  '(2 3))
#(expect-equal "signature not found in settings; subdiv. w/ custom base"
  (beat-structure 1/16 '((2 3) . 8) '())
  '(4 6))
#(expect-equal "signature not found in settings; subdiv. w/ senza-misura base"
  (beat-structure +inf.0 '((2 3) . 8) '())
  '())
%% robustness tests
#(expect-equal "signature not found in settings; zero numerator"
  (beat-structure 1/4 '(0 . 3) '())
  '())
#(expect-equal "signature not found in settings; zero denominator"
  (beat-structure 1/4 '(2 . 0) '())
  '(+inf.0))
#(expect-equal "signature not found in settings; zero base"
  (beat-structure 0 '(4 . 4) '())
  '(+inf.0))
#(expect-equal "subdivided signature not found in settings; zero numerator"
  (beat-structure 1/4 '((0 0) . 3) '())
  '(0 0)) % '() would be better, but this is just a robustness test
#(expect-equal "subdivided signature not found in settings; zero denominator"
  (beat-structure 1/4 '((1 2) . 0) '())
  '(+inf.0))
#(expect-equal "subdivided signature not found in settings; zero base"
  (beat-structure 0 '((3 4) . 4) '())
  '(+inf.0))

testSettings = #'(
  ((2 . 0) . ())
  ((0 . 3) . ())
  ((4 . 4) . ())
  (((4 3) . 2) . ())
  ((6 . 8) . ((beatBase . 1/4)
              (beatStructure . (1 1 1))))
  (((3 4) . 8) . ((beatBase . 1/16)
                  (beatStructure . (2 2 2 4 4))))
  (((4 3) . 8) . ((beatStructure . (2 2 1 1 1))))
  ((8 . 8) . ((beatStructure . (2 3 3))))
)

#(expect-equal "structure not found in settings; default base"
  (beat-structure 1/4 '(4 . 4) testSettings)
  '(1 1 1 1))
#(expect-equal "structure not found in settings; custom base"
  (beat-structure 1/8 '(4 . 4) testSettings)
  '(2 2 2 2))
#(expect-equal "structure not found in settings; senza-misura base"
  (beat-structure +inf.0 '(4 . 4) testSettings)
  '())
#(expect-equal "structure not found in settings; subdiv. w/ default base"
  (beat-structure 1/2 '((4 3) . 2) testSettings)
  '(4 3))
#(expect-equal "structure not found in settings; subdiv. w/ custom base"
  (beat-structure 1/4 '((4 3) . 2) testSettings)
  '(8 6))
#(expect-equal "structure not found in settings; subdiv. w/ senza-misura base"
  (beat-structure +inf.0 '((4 3) . 2) testSettings)
  '())
%% robustness tests
#(expect-equal "structure not found in settings; zero numerator"
  (beat-structure 1/4 '(0 . 3) testSettings)
  '())
#(expect-equal "structure not found in settings; zero denominator"
  (beat-structure 1/4 '(2 . 0) testSettings)
  '(+inf.0))
#(expect-equal "structure not found in settings; zero base"
  (beat-structure 0 '(4 . 4) testSettings)
  '(+inf.0))
#(expect-equal "subdivided structure not found in settings; zero numerator"
  (beat-structure 1/4
   '((0 0) . 3)
   '((((0 0) . 3) . ())))
  '(0 0)) % '() would be better, but this is just a robustness test
#(expect-equal "subdivided structure not found in settings; zero denominator"
  (beat-structure 1/4
   '((1 2) . 0)
   '((((1 2) . 0) . ())))
  '(+inf.0))
#(expect-equal "subdivided structure not found in settings; zero base"
  (beat-structure 0
   '((3 4) . 4)
   '((((3 4) . 4) . ())))
  '(+inf.0))

#(expect-equal "structure and base found in settings; same base"
  (beat-structure 1/4 '(6 . 8) testSettings)
  '(1 1 1))
#(expect-equal "structure and base found in settings; different base"
  (beat-structure 1/8 '(6 . 8) testSettings)
  '(2 2 2))
#(expect-equal "structure and base found in settings; senza-misura base"
  (beat-structure +inf.0 '(6 . 8) testSettings)
  '())
#(expect-equal "structure and base found; subdiv. w/ default base"
  (beat-structure 1/16 '((3 4) . 8) testSettings)
  '(2 2 2 4 4))
#(expect-equal "structure and base found; subdiv. w/ custom base"
  (beat-structure 1/8 '((3 4) . 8) testSettings)
  '(1 1 1 2 2))
#(expect-equal "structure and base found; subdiv. w/ senza-misura base"
  (beat-structure +inf.0 '((3 4) . 8) testSettings)
  '())
%% robustness test
#(expect-equal "structure and base found in settings; zero base"
  (beat-structure 0 '(6 . 8) testSettings)
  '(+inf.0))

#(expect-equal "structure found in settings; default base"
  (beat-structure 1/8 '(8 . 8) testSettings)
  '(2 3 3))
#(expect-equal "structure found in settings; custom base"
  (beat-structure 1/16 '(8 . 8) testSettings)
  '(4 6 6))
#(expect-equal "structure found in settings; senza-misura base"
  (beat-structure +inf.0 '(8 . 8) testSettings)
  '())
#(expect-equal "structure found in settings; subdiv. w/ default base"
  (beat-structure 1/8 '((4 3) . 8) testSettings)
  '(2 2 1 1 1))
#(expect-equal "structure found in settings; subdiv. w/ custom base"
  (beat-structure 1 '((4 3) . 8) testSettings)
  '(1/4 1/4 1/8 1/8 1/8))
#(expect-equal "structure found in settings; subdiv. w/ senza-misura base"
  (beat-structure +inf.0 '((4 3) . 8) testSettings)
  '())
%% robustness test
#(expect-equal "structure found in settings; zero base"
  (beat-structure 0 '(8 . 8) testSettings)
  '(+inf.0))



% ****************************************************************
% end ly snippet
% ****************************************************************
