diff --git a/tests/cicd/generate_docstring/java_test_file.java b/tests/cicd/generate_docstring/java_test_file.java index 51a073a3a..1a879a31d 100644 --- a/tests/cicd/generate_docstring/java_test_file.java +++ b/tests/cicd/generate_docstring/java_test_file.java @@ -1,8 +1,24 @@ class Test { + /** + * Adds two integers and returns the sum. + * + * @param a The first integer to be added + * @param b The second integer to be added + * @return The sum of the two input integers + */ + public static int a_plus_b(Integer a, Integer b) { return a + b; } + /** + * Compares two objects based on their mapped comparable values. + * + * @param keymap A function that maps objects to comparable values + * @param a The first object to compare + * @param b The second object to compare + * @return -1 if a < b, 1 if a > b, 0 if a == b + */ 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..90162c731 100644 --- a/tests/cicd/generate_docstring/js_test_file.py.js +++ b/tests/cicd/generate_docstring/js_test_file.py.js @@ -1,14 +1,41 @@ +/** + * Adds two numbers together. + * @param {number} a - The first number to add. + * @param {number} b - The second number to add. + * @returns {number} The sum of a and b. + */ function a_plus_b(a, b) { return a + b; } +/** + * Executes a SQLite query on the given database + * @param {Object} db - The SQLite database object + * @param {string} query - The SQL query to execute + * @param {Function} callback - The callback function to handle each row of the result + * @returns {void} This function doesn't return a value + */ const sqlite = (db, query, callback) => { + /** + * Serializes database operations and executes a query for each row + * @param {string} query - The SQL query to execute + * @param {function} callback - The function to call for each row returned + * @returns {undefined} This method doesn't return a value + */ + db.serialize(function () { db.each(query, callback); }); } +/** + * Compares two objects based on a specified key + * @param {string} keymap - The key to use for comparison + * @param {Object} a - The first object to compare + * @param {Object} b - The second object to compare + * @returns {number} -1 if a[keymap] < b[keymap], 1 if a[keymap] > b[keymap], 0 if 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..a548b3211 100644 --- a/tests/cicd/generate_docstring/python_test_file.py +++ b/tests/cicd/generate_docstring/python_test_file.py @@ -1,14 +1,42 @@ def a_plus_b(a, b): + """Add two numbers together. + + Args: + a (int or float): The first number to be added. + b (int or float): The second number to be added. + + Returns: + int or float: The sum of a and b. + """ return a + b def sqlite(db, query): + """Execute an SQL query on a SQLite database and retrieve all results. + + Args: + db (sqlite3.Connection): The SQLite database connection object. + query (str): The SQL query to execute. + + Returns: + list: A list of tuples containing all rows returned by the query. + """ cursor = db.cursor() cursor.execute(query) return cursor.fetchall() def compare(key_map, item1, item2): + """Compare two items based on a key mapping function. + + Args: + key_map (callable): A function that extracts a comparable value from an item. + item1 (Any): The first item to compare. + item2 (Any): The second item to compare. + + Returns: + int: -1 if item1 < item2, 1 if item1 > item2, 0 if item1 == item2. + """ if key_map(item1) < key_map(item2): return -1 elif key_map(item1) > key_map(item2):