%% 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/tsig-abbr-expand.ly"
\sourcefileline 0
\version "2.25.27"

\header {
  texidoc = "This tests the internal function tsig-abbr-expand.  Problems are
reported on stderr."
}

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% input is already canonical

#(expect-equal "simple fraction"
  (tsig-abbr-expand '(1 . 2))
  #f)

#(expect-equal "a/b in numerator"
  (tsig-abbr-expand '((1 . 2) . 3))
  #f)

#(expect-equal "a+b in numerator"
  (tsig-abbr-expand '((1 2) . 3))
  #f)

#(expect-equal "a+(b/c) in numerator"
  (tsig-abbr-expand '((1 (2 . 3)) . 4))
  #f)

#(expect-equal "(a/b)+c in numerator"
  (tsig-abbr-expand '(((1 . 2) 3) . 4))
  #f)

#(expect-equal "a+((b+c+d)/e) in numerator"
  (tsig-abbr-expand '((1 ((2 3 4) . 5)) . 6))
  #f)

#(expect-equal "a/b + c/d"
  (tsig-abbr-expand '((1 . 2) (3 . 4)))
  #f)

#(expect-equal "a/b + c/d + e/f"
  (tsig-abbr-expand '((1 . 2) (3 . 4) (5 . 6)))
  #f)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% input is abbreviated

#(expect-equal "simple fraction"
  (tsig-abbr-expand '(1 2))
  '(1 . 2))

#(expect-equal "list of one simple fraction"
  (tsig-abbr-expand '((1 2)))
  '(1 . 2))

#(expect-equal "a/b in numerator"
  (tsig-abbr-expand '((1 2) 3))
  '((1 . 2) . 3))

#(expect-equal "a+b in numerator"
  (tsig-abbr-expand '(1 2 3))
  '((1 2) . 3))

#(expect-equal "a+(b/c) in numerator"
  (tsig-abbr-expand '(1 (2 3) 4))
  '((1 (2 . 3)) . 4))

#(expect-equal "(a/b)+c in numerator"
  (tsig-abbr-expand '((1 2) 3 4))
  '(((1 . 2) 3) . 4))

#(expect-equal "a+((b+c+d)/e) in numerator"
  (tsig-abbr-expand '(1 (2 3 4 5) 6))
  '((1 ((2 3 4) . 5)) . 6))

#(expect-equal "a/b + c/d"
  (tsig-abbr-expand '((1 2) (3 4)))
  '((1 . 2) (3 . 4)))

#(expect-equal "a/b + c/d + e/f"
  (tsig-abbr-expand '((1 2) (3 4) (5 6)))
  '((1 . 2) (3 . 4) (5 . 6)))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% input is partly abbreviated

#(expect-equal "a/b in numerator"
  (tsig-abbr-expand '((1 . 2) 3))
  #f)

#(expect-equal "a+(b/c) in numerator"
  (tsig-abbr-expand '(1 (2 . 3) 4))
  #f)

#(expect-equal "(a/b)+c in numerator"
  (tsig-abbr-expand '((1 . 2) 3 4))
  #f)

#(expect-equal "a+((b+c+d)/e) in numerator"
  (tsig-abbr-expand '(1 ((2 3 4) . 5) 6))
  #f)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% other

#(expect-equal "senza misura"
  (tsig-abbr-expand #f)
  #f)



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