-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-dynamic-wrapper.js
More file actions
31 lines (25 loc) · 965 Bytes
/
test-dynamic-wrapper.js
File metadata and controls
31 lines (25 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Quick test to show how the dynamic wrapper works now
const metadata = {
functionName: "isValid",
parameters: [{ name: "s", type: "string" }],
returnType: "boolean"
};
const userCode = `class Solution {
public boolean isValid(String s) {
// User's solution here
return true;
}
}`;
console.log("=== For Valid Parentheses Problem ===");
console.log("\n1. Function Metadata from DB:");
console.log(JSON.stringify(metadata, null, 2));
console.log("\n2. User writes only:");
console.log(userCode);
console.log("\n3. System auto-generates wrapper that:");
console.log(" - Reads JSON input: {\"s\": \"()\"} ");
console.log(" - Extracts parameter: s");
console.log(" - Calls: solution.isValid(s)");
console.log(" - Returns result as JSON");
console.log("\n✅ No more hardcoded 'twoSum' errors!");
console.log("✅ Each problem uses its own function name");
console.log("✅ Supports different parameter types automatically");