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
15 changes: 15 additions & 0 deletions tests/cicd/generate_docstring/java_test_file.java
Original file line number Diff line number Diff line change
@@ -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<Object, Comparable> keymap, object a, Object b) {
if (keymap(a) < keymap(b)) {
return -1;
Expand Down
20 changes: 20 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,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;
Expand Down
29 changes: 29 additions & 0 deletions tests/cicd/generate_docstring/python_test_file.py
Original file line number Diff line number Diff line change
@@ -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 <SQLite Connection>: The connection to the SQLite database.
query <str>: 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):
Expand Down