Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/cicd/generate_docstring/java_test_file.java
Original file line number Diff line number Diff line change
@@ -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<Object, Comparable> keymap, object a, Object b) {
if (keymap(a) < keymap(b)) {
return -1;
Expand Down
27 changes: 27 additions & 0 deletions tests/cicd/generate_docstring/js_test_file.py.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
28 changes: 28 additions & 0 deletions tests/cicd/generate_docstring/python_test_file.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down