diff --git a/tests/cicd/generate_docstring/java_test_file.java b/tests/cicd/generate_docstring/java_test_file.java index 51a073a3a..80dba82ee 100644 --- a/tests/cicd/generate_docstring/java_test_file.java +++ b/tests/cicd/generate_docstring/java_test_file.java @@ -1,8 +1,23 @@ class Test { + /** + * Computes the sum of two integers. + * + * @param a The first integer + * @param b The second integer + * @return The sum of the two integers + */ public static int a_plus_b(Integer a, Integer b) { return a + b; } + /** + * Compares two objects 'a' and 'b' based on their mapping values using the provided keymap Function. + * + * @param keymap The mapping function used to retrieve comparable values from the objects + * @param a The first object to compare + * @param b The second object to compare + * @return -1 if keymap(a) is less than keymap(b), 1 if keymap(a) is greater than keymap(b), 0 if they are equal + */ public static int a_plus_b(Function keymap, object a, Object b) { if (keymap(a) < keymap(b)) { return -1; diff --git a/tests/cicd/generate_docstring/js_test_file.py.js b/tests/cicd/generate_docstring/js_test_file.py.js index 11e6ee818..cf4f12ce8 100644 --- a/tests/cicd/generate_docstring/js_test_file.py.js +++ b/tests/cicd/generate_docstring/js_test_file.py.js @@ -1,14 +1,34 @@ +/** + * Calculates the sum of two numbers. + * @param {number} a - The first number + * @param {number} b - The second number + * @returns {number} The sum of a and b + */ function a_plus_b(a, b) { return a + b; } +/** + * Execute an SQLite query on the provided database + * @param {Object} db - The SQLite database object + * @param {string} query - The SQL query to be executed + * @param {Function} callback - The callback function to handle each row of the result set + * @returns {void} + */ const sqlite = (db, query, callback) => { db.serialize(function () { db.each(query, callback); }); } +/** + * Compares two objects based on a specified key. + * @param {string} keymap - The key to compare the objects with. + * @param {Object} a - The first object to compare. + * @param {Object} b - The second object to compare. + * @returns {number} Returns -1 if a[keymap] is less than b[keymap], 1 if a[keymap] is greater than b[keymap], or 0 if they are equal. + */ const compare= function (keymap, a, b) { if (a[keymap] < b[keymap]) { return -1; diff --git a/tests/cicd/generate_docstring/python_test_file.py b/tests/cicd/generate_docstring/python_test_file.py index e23826d79..e34bc7351 100644 --- a/tests/cicd/generate_docstring/python_test_file.py +++ b/tests/cicd/generate_docstring/python_test_file.py @@ -1,14 +1,43 @@ def a_plus_b(a, b): + """Adds two numbers together. + + Args: + a int: The first number to be added. + b int: The second number to be added. + + Returns: + int: The sum of the two input numbers. + """ return a + b def sqlite(db, query): + """Execute a query on a SQLite database and fetch all the results. + + Args: + db : The connection to the SQLite database. + query : The SQL query to be executed. + + Returns: + list: A list containing all the rows fetched as a result of the query. + """ cursor = db.cursor() cursor.execute(query) return cursor.fetchall() def compare(key_map, item1, item2): + """Compares two items based on the key_map function. + + Args: + key_map function: A function that maps an item to a comparable key. + item1 any: The first item to compare. + item2 any: The second item to compare. + + Returns: + int: -1 if key_map(item1) is less than key_map(item2), 1 if key_map(item1) is greater than key_map(item2), + or 0 if they are equal. + """ if key_map(item1) < key_map(item2): return -1 elif key_map(item1) > key_map(item2):