@@ -136,11 +136,22 @@ public void ReadmeSample()
136136 }
137137
138138 [ Test ]
139- public void Parse_Variable_Invalid ( )
139+ public void Parse_Variable_Names ( )
140140 {
141141 var context = new ExpresionContext < float > ( ) ;
142- context . RegisterVariable ( "a" , ( ) => 1 ) ;
143- Assert . AreEqual ( 1 , Execute ( "a" , context ) ) ;
142+ context . RegisterVariable ( "o" , ( ) => 1 ) ;
143+ context . RegisterVariable ( "one" , ( ) => 1 ) ;
144+ context . RegisterVariable ( "one123" , ( ) => 1 ) ;
145+ context . RegisterVariable ( "_one123" , ( ) => 1 ) ;
146+ context . RegisterVariable ( "one_123" , ( ) => 1 ) ;
147+ context . RegisterVariable ( "one123_" , ( ) => 1 ) ;
148+ Assert . AreEqual ( 1 , Execute ( "o" , context ) ) ;
149+ Assert . AreEqual ( 1 , Execute ( "one" , context ) ) ;
150+ Assert . AreEqual ( 1 , Execute ( "one123" , context ) ) ;
151+ Assert . AreEqual ( 1 , Execute ( "_one123" , context ) ) ;
152+ Assert . AreEqual ( 1 , Execute ( "one_123" , context ) ) ;
153+ Assert . AreEqual ( 1 , Execute ( "one123_" , context ) ) ;
154+ Assert . Throws < ParseException > ( ( ) => Compile ( "123one" , context ) ) ;
144155 Assert . Throws < VariableNotDefinedException > ( ( ) => Compile ( "b" , context ) ) ;
145156 }
146157
0 commit comments