@@ -133,35 +133,33 @@ describe('metacall', () => {
133133 // Receiving undefined from a function that returns nothing in Python
134134 assert . strictEqual ( f . function_pass ( ) , undefined ) ;
135135
136+ // Opaque pointer for class instances
137+ assert . strictEqual ( f . function_capsule_method ( f . function_capsule_new_class ( ) ) , 'hello world' ) ;
138+
139+ // Opaque pointer for class instances with callback
140+ assert . strictEqual ( f . function_capsule_cb ( ( klass ) => f . function_capsule_method ( klass ) ) , 'hello world' ) ;
141+
136142 // Double recursion
137- /*
138143 const sum = ( value , f ) => value <= 0 ? 0 : value + f ( value - 1 , sum ) ;
139144 assert . strictEqual ( sum ( 5 , f . function_sum ) , 15 ) ;
145+ assert . strictEqual ( sum ( 5 , f . function_sum ) , 15 ) ; // Check for function lifetime
140146 assert . strictEqual ( f . function_sum ( 5 , sum ) , 15 ) ;
141- */
147+ assert . strictEqual ( f . function_sum ( 5 , sum ) , 15 ) ; // Check for function lifetime
142148
143149 // Factorial composition (@trgwii)
144- /*
145- const fact = f.function_factorial(c => v => v <= 0 ? 1 : v);
146- assert.strictEqual(fact(0), 1);
147- assert.strictEqual(fact(1), 1);
148- assert.strictEqual(fact(2), 2);
149- assert.strictEqual(fact(3), 6);
150-
151- const js_factorial = f.function_chain((x) => (n) => n == 0 ? 1 : n * x(x)(n - 1));
152- assert.notStrictEqual(js_factorial, undefined);
153- assert.strictEqual(js_factorial(5), 120);
154-
155- const py_factorial = f.function_chain(f.function_factorial);
156- assert.notStrictEqual(py_factorial, undefined);
157- assert.strictEqual(py_factorial(5), 120);
158- */
159-
160- // Opaque pointer for class instances
161- assert . strictEqual ( f . function_capsule_method ( f . function_capsule_new_class ( ) ) , 'hello world' ) ;
162-
163- // Opaque pointer for class instances with callback
164- assert . strictEqual ( f . function_capsule_cb ( ( klass ) => f . function_capsule_method ( klass ) ) , 'hello world' ) ;
150+ // const fact = f.function_factorial(c => v => v <= 0 ? 1 : v);
151+ // assert.strictEqual(fact(1), 1);
152+ // assert.strictEqual(fact(2), 2);
153+ // assert.strictEqual(fact(3), 6);
154+ // assert.strictEqual(fact(50000), 2499950000);
155+
156+ // const js_factorial = f.function_chain((x) => (n) => n == 0 ? 1 : n * x(x)(n - 1));
157+ // assert.notStrictEqual(js_factorial, undefined);
158+ // assert.strictEqual(js_factorial(5), 120);
159+
160+ // const py_factorial = f.function_chain(f.function_factorial);
161+ // assert.notStrictEqual(py_factorial, undefined);
162+ // assert.strictEqual(py_factorial(5), 120);
165163 } ) ;
166164 } ) ;
167165} ) ;
0 commit comments