File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
xFunc.Maths/Analyzers/Formatters
xFunc.Tests/Analyzers/Formatters Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,12 @@ public virtual string Analyze(Exp exp)
103103
104104 /// <inheritdoc />
105105 public virtual string Analyze ( Fact exp )
106- => ToString ( exp , "{0}!" ) ;
106+ {
107+ if ( exp . Argument is BinaryExpression )
108+ return ToString ( exp , "({0})!" ) ;
109+
110+ return ToString ( exp , "{0}!" ) ;
111+ }
107112
108113 /// <inheritdoc />
109114 public virtual string Analyze ( Floor exp )
Original file line number Diff line number Diff line change @@ -124,6 +124,14 @@ public void FactToStringTest()
124124 Assert . That ( exp . ToString ( ) , Is . EqualTo ( "5!" ) ) ;
125125 }
126126
127+ [ Test ]
128+ public void FactWithBinaryToStringTest ( )
129+ {
130+ var exp = new Fact ( new Add ( Number . One , Number . Two ) ) ;
131+
132+ Assert . That ( exp . ToString ( ) , Is . EqualTo ( "(1 + 2)!" ) ) ;
133+ }
134+
127135 [ Test ]
128136 public void FloorToStringTest ( )
129137 {
You can’t perform that action at this time.
0 commit comments