diff --git a/src/test-llm-autocompletion/README.md b/src/test-llm-autocompletion/README.md index 410c0f4722b..05018b10a6d 100644 --- a/src/test-llm-autocompletion/README.md +++ b/src/test-llm-autocompletion/README.md @@ -67,6 +67,13 @@ pnpm run test -oa # Run a single test pnpm run test closing-brace +# Run tests multiple times (works for both single test and all tests) +pnpm run test --runs 5 +pnpm run test closing-brace --runs 5 +# Or short form +pnpm run test -r 5 +pnpm run test closing-brace -r 5 + # Clean up orphaned approval files pnpm run clean diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.1.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.1.txt index 8620a8e89e8..1f049fdff6e 100644 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.1.txt @@ -5,4 +5,8 @@ class ApiClient { headers: { 'Content-Type': 'application/json', }, - <<>> \ No newline at end of file + body: JSON.stringify(data), + }); + return await response.json(); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.10.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.10.txt deleted file mode 100644 index 6ad845ca2b7..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.10.txt +++ /dev/null @@ -1,17 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - return await response.json(); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.11.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.11.txt deleted file mode 100644 index 422deced4fa..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.11.txt +++ /dev/null @@ -1,15 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return await response.json(); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.12.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.12.txt deleted file mode 100644 index 1f049fdff6e..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.12.txt +++ /dev/null @@ -1,12 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - return await response.json(); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.13.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.13.txt deleted file mode 100644 index e34232ec24c..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.13.txt +++ /dev/null @@ -1,15 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.15.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.15.txt deleted file mode 100644 index 722fd6407b4..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.15.txt +++ /dev/null @@ -1,12 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - const result = await response.json(); - return result; - } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.16.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.16.txt deleted file mode 100644 index 5e8f11392d1..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.16.txt +++ /dev/null @@ -1,14 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return await response.json(); - } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.17.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.17.txt deleted file mode 100644 index 19ed8c724df..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.17.txt +++ /dev/null @@ -1,12 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - const json = await response.json(); - return json; - } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.18.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.18.txt deleted file mode 100644 index 6b0f59ccaf3..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.18.txt +++ /dev/null @@ -1,9 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.14.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.2.txt similarity index 100% rename from src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.14.txt rename to src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.2.txt diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.3.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.3.txt index 84d8f8dd6e3..6ad845ca2b7 100644 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.3.txt @@ -3,6 +3,15 @@ class ApiClient { const response = await fetch(this.baseUrl + endpoint, { method: 'POST', headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', }, - body: JSON.stringify(data) \ No newline at end of file + body: JSON.stringify(data), + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + return await response.json(); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.5.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.5.txt deleted file mode 100644 index 340b83c433c..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.5.txt +++ /dev/null @@ -1,6 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(data) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.7.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.7.txt deleted file mode 100644 index aa253e6844d..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.7.txt +++ /dev/null @@ -1,5 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.8.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.8.txt deleted file mode 100644 index 61dfb205a26..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.8.txt +++ /dev/null @@ -1,9 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.9.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.9.txt deleted file mode 100644 index 113723778b8..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.approved.9.txt +++ /dev/null @@ -1,8 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.2.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.2.txt deleted file mode 100644 index 4e3596e72fd..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.2.txt +++ /dev/null @@ -1,5 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.4.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.4.txt deleted file mode 100644 index 2a41222722c..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.4.txt +++ /dev/null @@ -1 +0,0 @@ -(no changes parsed) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.6.txt b/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.6.txt deleted file mode 100644 index 1a2285f95b3..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/rest-api-client.rejected.6.txt +++ /dev/null @@ -1,12 +0,0 @@ -class ApiClient { - async post(endpoint, data) { - const response = await fetch(this.baseUrl + endpoint, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - return await response.json(); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.1.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.1.txt index 1b90e4a8b36..14896130701 100644 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.1.txt @@ -4,4 +4,7 @@ async function fetchWithRetry(url, maxRetries = 3) { return await fetch(url); } catch (error) { if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)) \ No newline at end of file + await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1))); + } + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.10.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.10.txt deleted file mode 100644 index f6207fc8faf..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.10.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1))); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.11.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.11.txt deleted file mode 100644 index b983f7b3b36..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.11.txt +++ /dev/null @@ -1,10 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second before retrying - } - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.12.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.12.txt deleted file mode 100644 index 0fb941a5dc6..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.12.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)); // 1 second delay \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.13.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.13.txt deleted file mode 100644 index c7910daaddc..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.13.txt +++ /dev/null @@ -1,11 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)); - } - } - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.15.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.15.txt deleted file mode 100644 index c6ca0df445e..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.15.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.16.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.16.txt deleted file mode 100644 index a0dd9bee938..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.16.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000 * Math.pow(2, attempt) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.17.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.17.txt deleted file mode 100644 index 14896130701..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.17.txt +++ /dev/null @@ -1,10 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1))); - } - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.14.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.2.txt similarity index 100% rename from src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.14.txt rename to src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.2.txt diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.3.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.3.txt deleted file mode 100644 index 9edf6f92058..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.3.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.5.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.5.txt deleted file mode 100644 index eac66d69c37..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.5.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.7.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.7.txt deleted file mode 100644 index 809e89705df..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.7.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.8.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.8.txt deleted file mode 100644 index 4825b496236..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.8.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000 * Math.pow(2, attempt))) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.9.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.9.txt deleted file mode 100644 index eebf0d0d252..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.approved.9.txt +++ /dev/null @@ -1,8 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)); -``` \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.2.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.2.txt deleted file mode 100644 index 2a41222722c..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.2.txt +++ /dev/null @@ -1 +0,0 @@ -(no changes parsed) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.4.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.4.txt deleted file mode 100644 index cdaffae16e5..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.4.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.6.txt b/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.6.txt deleted file mode 100644 index c17039d187d..00000000000 --- a/src/test-llm-autocompletion/approvals/api-patterns/retry-logic.rejected.6.txt +++ /dev/null @@ -1,7 +0,0 @@ -async function fetchWithRetry(url, maxRetries = 3) { - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - return await fetch(url); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - await new Promise(resolve => setTimeout(resolve, 1000)]); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.1.txt index 76913db8b27..99d8d7bb0ed 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.1.txt @@ -1,4 +1,17 @@ class User { constructor(username, email, role) { this.username = username; - this.email = email \ No newline at end of file + this.email = email; + this.role = role; + } + + login() { + console.log(`${this.username} has logged in`); + return this; + } + + logout() { + console.log(`${this.username} has logged out`); + return this; + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.10.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.10.txt new file mode 100644 index 00000000000..60694501efd --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.10.txt @@ -0,0 +1,15 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } + + getInfo() { + return `${this.username} ${this.email} ${this.role}`; + } + + isAdmin() { + return this.role === "admin"; + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.11.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.11.txt index c2689df0e23..2788229fc84 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.11.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.11.txt @@ -1,4 +1,9 @@ class User { constructor(username, email, role) { this.username = username; - this.email = email, \ No newline at end of file + this.email = email; + this.role = role; + } +} + +export default User; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.12.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.12.txt new file mode 100644 index 00000000000..93f9072da44 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.12.txt @@ -0,0 +1,19 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } + + getInfo() { + return `${this.username} ${this.email} ${this.role}`; + } + + isAdmin() { + return this.role === "admin"; + } +} + +const user1 = new User("john", "john@example.com", "admin"); +console.log(user1.getInfo()); +console.log(user1.isAdmin()); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.13.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.13.txt index 394667563d1..76c2b1bbc8c 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.13.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.13.txt @@ -6,4 +6,27 @@ class User { } } -module.exports = User; \ No newline at end of file +class Admin extends User { + constructor(username, email, role) { + super(username, email, role); + this.role = 'admin'; + } +} + +class UserFactory { + createUser(username, email, role) { + if (role === 'admin') { + return new Admin(username, email, role); + } else { + return new User(username, email, role); + } + } +} + +const userFactory = new UserFactory(); + +const user1 = userFactory.createUser('john_doe', 'john@example.com', 'user'); +const admin1 = userFactory.createUser('admin_user', 'admin@example.com', 'admin'); + +console.log(user1); +console.log(admin1); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.14.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.14.txt new file mode 100644 index 00000000000..5f1e49b35d2 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.14.txt @@ -0,0 +1,35 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } + + login() { + console.log(`${this.username} has logged in`); + return this; + } + + logout() { + console.log(`${this.username} has logged out`); + return this; + } +} + +class Admin extends User { + deleteUser(user) { + users = users.filter((u) => u.username !== user.username); + } +} + +const userOne = new User('mario', 'mario@thenetninja.co.uk', 'admin'); +const userTwo = new User('luigi', 'luigi@thenetninja.co.uk', 'user'); +const userThree = new Admin('shaun', 'shaun@thenetninja.co.uk', 'admin'); + +let users = [userOne, userTwo, userThree]; + +console.log(users); + +userThree.deleteUser(userTwo); + +console.log(users); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.15.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.15.txt new file mode 100644 index 00000000000..981d3d4fc0c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.15.txt @@ -0,0 +1,35 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } + + login() { + console.log(`${this.username} has logged in`); + return this; + } + + logout() { + console.log(`${this.username} has logged out`); + return this; + } +} + +class Admin extends User { + deleteUser(user) { + users = users.filter((u) => u.username !== user.username); + } +} + +const userOne = new User("mario", "mario@thenetninja.co.uk", "admin"); +const userTwo = new User("luigi", "luigi@thenetninja.co.uk", "user"); +const userThree = new Admin("shaun", "shaun@thenetninja.co.uk", "admin"); + +let users = [userOne, userTwo, userThree]; + +console.log(users); + +userThree.deleteUser(userTwo); + +console.log(users); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.16.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.16.txt new file mode 100644 index 00000000000..8b3e4ffb682 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.16.txt @@ -0,0 +1,19 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } +} + +class Admin extends User { + constructor(username, email, role) { + super(username, email, role); + } +} + +const user1 = new User("John", "john@example.com", "user"); +const admin1 = new Admin("Jane", "jane@example.com", "admin"); + +console.log(user1); +console.log(admin1); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.17.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.17.txt new file mode 100644 index 00000000000..7976ebf02f5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.17.txt @@ -0,0 +1,23 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } + + getInfo() { + return `${this.username} ${this.email} ${this.role}`; + } + + isAdmin() { + return this.role === 'admin'; + } +} + +const user1 = new User('John', 'john@example.com', 'admin'); +console.log(user1.getInfo()); +console.log(user1.isAdmin()); + +const user2 = new User('Jane', 'jane@example.com', 'user'); +console.log(user2.getInfo()); +console.log(user2.isAdmin()); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.18.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.18.txt new file mode 100644 index 00000000000..c120b5c5179 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.18.txt @@ -0,0 +1,22 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } +} + +class Admin extends User { + constructor(username, email, role, permissions) { + super(username, email, role); + this.permissions = permissions; + } +} + +const userOne = new User("mario", "mario@thenetninja.co.uk", "admin"); +const userTwo = new User("luigi", "luigi@thenetninja.co.uk", "user"); +const userThree = new Admin("shaun", "shaun@thenetninja.co.uk", "admin", [ + "delete", +]); + +console.log(userOne, userTwo, userThree); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.2.txt new file mode 100644 index 00000000000..afd16091df9 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.2.txt @@ -0,0 +1,19 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } +} + +class Admin extends User { + constructor(username, email, role, permissions) { + super(username, email, role); + this.permissions = permissions; + } +} + +const userOne = new User('mario', 'mario@thenetninja.co.uk', 'admin'); +const userTwo = new Admin('luigi', 'luigi@thenetninja.co.uk', 'admin', ['delete', 'create', 'update']); + +console.log(userOne, userTwo); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.3.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.3.txt index 74d384f866d..394667563d1 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.3.txt @@ -1,4 +1,9 @@ class User { constructor(username, email, role) { this.username = username; - this.email = email; \ No newline at end of file + this.email = email; + this.role = role; + } +} + +module.exports = User; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.4.txt new file mode 100644 index 00000000000..21d3f3b10a8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.4.txt @@ -0,0 +1,32 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } + + login() { + console.log(`${this.username} has logged in`); + return this; + } + + logout() { + console.log(`${this.username} has logged out`); + return this; + } +} + +class Admin extends User { + deleteUser(user) { + users = users.filter((u) => u.username !== user.username); + } +} + +const userOne = new User('mario', 'mario@thenetninja.co.uk', 'admin'); +const userTwo = new User('luigi', 'luigi@thenetninja.co.uk', 'moderator'); +const userThree = new Admin('shaun', 'shaun@thenetninja.co.uk', 'admin'); + +let users = [userOne, userTwo, userThree]; + +console.log(userThree.deleteUser(userTwo)); +console.log(users); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.5.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.5.txt index 286f6e8bfb3..059c7b2bd92 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.5.txt @@ -3,4 +3,27 @@ class User { this.username = username; this.email = email; this.role = role; - } \ No newline at end of file + } +} + +class Admin extends User { + constructor(username, email, role) { + super(username, email, role); + this.role = "admin"; + } +} + +class SuperAdmin extends Admin { + constructor(username, email, role) { + super(username, email, role); + this.role = "super-admin"; + } +} + +const user1 = new User("user1", "user1@example.com", "user"); +const admin1 = new Admin("admin1", "admin1@example.com", "admin"); +const superAdmin1 = new SuperAdmin("superAdmin1", "superAdmin1@example.com", "super-admin"); + +console.log(user1); +console.log(admin1); +console.log(superAdmin1); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.6.txt new file mode 100644 index 00000000000..924d656be17 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.6.txt @@ -0,0 +1,29 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } +} + +class Admin extends User { + constructor(username, email, role) { + super(username, email, role); + this.role = "admin"; + } +} + +class SuperAdmin extends Admin { + constructor(username, email, role) { + super(username, email, role); + this.role = "superadmin"; + } +} + +const user1 = new User("user1", "user1@example.com", "user"); +const admin1 = new Admin("admin1", "admin1@example.com", "admin"); +const superadmin1 = new SuperAdmin("superadmin1", "superadmin1@example.com", "superadmin"); + +console.log(user1); +console.log(admin1); +console.log(superadmin1); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.7.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.7.txt index 050d47cece8..9784da6dd8d 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.7.txt @@ -4,4 +4,12 @@ class User { this.email = email; this.role = role; } + + getInfo() { + return `${this.username} ${this.email} ${this.role}`; + } + + isAdmin() { + return this.role === 'admin'; + } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.8.txt new file mode 100644 index 00000000000..d199fa5cc5d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.8.txt @@ -0,0 +1,29 @@ +class User { + constructor(username, email, role) { + this.username = username; + this.email = email; + this.role = role; + } +} + +class Admin extends User { + constructor(username, email, role) { + super(username, email, role); + } +} + +class UserFactory { + static createUser(username, email, role) { + if (role === "admin") { + return new Admin(username, email, role); + } else { + return new User(username, email, role); + } + } +} + +const user1 = UserFactory.createUser("John", "john@example.com", "user"); +const admin1 = UserFactory.createUser("Jane", "jane@example.com", "admin"); + +console.log(user1); +console.log(admin1); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.9.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.9.txt index ae3dbddc03c..7794a656989 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.approved.9.txt @@ -1,7 +1,29 @@ class User { constructor(username, email, role) { this.username = username; - this.email = email, role) { + this.email = email; this.role = role; } -} \ No newline at end of file +} + +class Admin extends User { + constructor(username, email, role) { + super(username, email, role); + } +} + +class UserFactory { + static createUser(username, email, role) { + if (role === 'admin') { + return new Admin(username, email, role); + } else { + return new User(username, email, role); + } + } +} + +const user1 = UserFactory.createUser('John', 'john@example.com', 'user'); +const user2 = UserFactory.createUser('Jane', 'jane@example.com', 'admin'); + +console.log(user1); +console.log(user2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.1.txt deleted file mode 100644 index c66d0a9148c..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.1.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User - def initialize(username, email, role) - @username = username - @email = email \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.12.txt new file mode 100644 index 00000000000..cd1bbbd463c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.12.txt @@ -0,0 +1,11 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.13.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.13.txt new file mode 100644 index 00000000000..81c70b6fde0 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.13.txt @@ -0,0 +1,26 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} #{@email} #{@role}" + end +end + +user = User.new("john", "john@email.com", "admin") +puts user \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.14.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.14.txt new file mode 100644 index 00000000000..537f13dc892 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.14.txt @@ -0,0 +1,27 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} (#{@email})" + end + + def ==(other) + @username == other.username && @email == other.email && @role == other.role + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.3.txt index 3beebbd8e29..3e3db6a34e5 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.3.txt @@ -1,4 +1,19 @@ class User def initialize(username, email, role) @username = username - this.email = email; \ No newline at end of file + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.4.txt similarity index 85% rename from src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.8.txt rename to src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.4.txt index 6a8f804e49a..03a3d54d4f4 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.4.txt @@ -18,6 +18,6 @@ class User end def to_s - "#{@username} (#{@email})" + "#{@username} #{@email} #{@role}" end end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.5.txt index 9cce93fb975..6a8f804e49a 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.5.txt @@ -2,4 +2,22 @@ class User def initialize(username, email, role) @username = username @email = email - @role = role \ No newline at end of file + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} (#{@email})" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.6.txt index fe4df40954f..30c878b3519 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.6.txt @@ -4,4 +4,20 @@ class User @email = email @role = role end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.7.txt index 89b53d575e8..110dbd40133 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.approved.7.txt @@ -3,4 +3,24 @@ class User @username = username @email = email @role = role - end \ No newline at end of file + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username}, #{@email}, #{@role}" + end +end + +user = User.new("john", "john@email.com", "admin") +puts user \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.1.txt new file mode 100644 index 00000000000..511766cfa48 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.1.txt @@ -0,0 +1,60 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end + +class Admin < User + def initialize(username, email) + super(username, email, "admin") + end +end + +class Guest < User + def initialize(username, email) + super(username, email, "guest") + end +end + +class Moderator < User + def initialize(username, email) + super(username, email, "moderator") + end +end + +class UserFactory + def self.create(username, email, role) + case role + when "admin" + Admin.new(username, email) + when "guest" + Guest.new(username, email) + when "moderator" + Moderator.new(username, email) + else + raise "Invalid role" + end + end +end + +admin = UserFactory.create("admin", "admin@example.com", "admin") +guest = UserFactory.create("guest", "guest@example.com", "guest") +moderator = UserFactory \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.10.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.10.txt new file mode 100644 index 00000000000..96f192ebf6e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.10.txt @@ -0,0 +1,59 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end + +class Admin < User + def initialize(username, email, role) + super(username, email, role) + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end + +class Moderator < User + def initialize(username, email, role) + super(username, email, role) + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end + +class UserFactory + def self.create_user(username, email, role) + case role + when "admin" + Admin.new(username, email, role) + when "moderator" + Moderator.new(username, email, role) + else + User.new(username, email, role) + end + end +end + +user = UserFactory.create_user("john", "john@example.com", "admin") +puts user \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.11.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.11.txt new file mode 100644 index 00000000000..94ec3a2bc5a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.11.txt @@ -0,0 +1,49 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end + +class Admin < User + def initialize(username, email) + super(username, email, "admin") + end +end + +class Guest < User + def initialize(username, email) + super(username, email, "guest") + end +end + +class Moderator < User + def initialize(username, email) + super(username, email, "moderator") + end +end + +admin = Admin.new("admin", "admin@admin.com") +guest = Guest.new("guest", "guest@guest.com") +moderator = Moderator.new("moderator", "moderator@moderator.com") + +puts admin +puts guest +puts moderator \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.2.txt index f1244ea7b85..7d217edb41a 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.2.txt @@ -1,4 +1,65 @@ class User def initialize(username, email, role) @username = username - @email = <<>> \ No newline at end of file + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} #{@email} #{@role}" + end +end + +class Admin < User + def initialize(username, email) + super(username, email, "admin") + end +end + +class Guest < User + def initialize(username, email) + super(username, email, "guest") + end +end + +class Member < User + def initialize(username, email) + super(username, email, "member") + end +end + +class Moderator < User + def initialize(username, email) + super(username, email, "moderator") + end +end + +class SuperAdmin < User + def initialize(username, email) + super(username, email, "super_admin") + end +end + +class UserFactory + def self.create(username, email, role) + case role + when "admin" + Admin.new(username, email) + when "guest" + Guest.new(username, email) + when "member" + Member.new(username, email) + when "moderator" + \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.4.txt deleted file mode 100644 index 3e3d163e8b5..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.4.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User - def initialize(username, email, role) - @username = username - @email = email, role \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.8.txt new file mode 100644 index 00000000000..8d3ed97bf00 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.8.txt @@ -0,0 +1,60 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} - #{@email} - #{@role}" + end +end + +class Admin < User + def initialize(username, email) + super(username, email, "admin") + end +end + +class Guest < User + def initialize(username, email) + super(username, email, "guest") + end +end + +class Moderator < User + def initialize(username, email) + super(username, email, "moderator") + end +end + +class UserFactory + def self.create_user(username, email, role) + case role + when "admin" + Admin.new(username, email) + when "guest" + Guest.new(username, email) + when "moderator" + Moderator.new(username, email) + else + raise ArgumentError, "Invalid role" + end + end +end + +# Example usage: +admin = UserFactory.create_user("admin_user", "admin@example.com", "admin") +guest = UserFactory.create_user("guest_user", " \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.9.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.9.txt new file mode 100644 index 00000000000..edbb928b3f3 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rb.rejected.9.txt @@ -0,0 +1,60 @@ +class User + def initialize(username, email, role) + @username = username + @email = email + @role = role + end + + def username + @username + end + + def email + @email + end + + def role + @role + end + + def to_s + "#{@username} #{@email} #{@role}" + end +end + +class Admin < User + def initialize(username, email) + super(username, email, "admin") + end +end + +class Guest < User + def initialize(username, email) + super(username, email, "guest") + end +end + +class Member < User + def initialize(username, email) + super(username, email, "member") + end +end + +class UserFactory + def self.create_user(username, email, role) + case role + when "admin" + Admin.new(username, email) + when "guest" + Guest.new(username, email) + when "member" + Member.new(username, email) + else + raise ArgumentError, "Invalid role" + end + end +end + +# Example usage: +admin = UserFactory.create_user("admin_user", "admin@example.com", "admin") +guest = UserFactory.create_user("guest_user", "guest@example.com", "guest") diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.10.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.10.txt deleted file mode 100644 index add624cc564..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.10.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User { - constructor(username, email, role) { - this.username = username; - this.email = email, role = role; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.12.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.12.txt deleted file mode 100644 index a96231e4b2f..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.12.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User { - constructor(username, email, role) { - this.username = username; - this.email = email, role \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.2.txt deleted file mode 100644 index 362a2547801..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.2.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User { - constructor(username, email, role) { - this.username = username; - this.email = <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.4.txt deleted file mode 100644 index 98571dcafb3..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.4.txt +++ /dev/null @@ -1,7 +0,0 @@ -class User { - constructor(username, email, role) { - this.username = username; - this.email = email, - this.role = role; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.6.txt deleted file mode 100644 index bbad8267875..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.6.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User { - constructor(username, email, role) { - this.username = username; - this.email = email, this.role = role \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.8.txt deleted file mode 100644 index 5a0faaeb93c..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-constructor.rejected.8.txt +++ /dev/null @@ -1,4 +0,0 @@ -class User { - constructor(username, email, role) { - this.username = username; - this.email = email, this.role = role; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.1.txt index 6026f90351a..7e2e2d8d0e7 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.1.txt @@ -6,4 +6,11 @@ class Animal { class Dog extends Animal { constructor(name, breed) { - super(name); \ No newline at end of file + super(name); + this.breed = breed; + } +} + +const dog = new Dog('Rex', 'German Shepherd'); +console.log(dog.name); // Rex +console.log(dog.breed); // German Shepherd \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.10.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.2.txt similarity index 100% rename from src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.10.txt rename to src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.2.txt diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.3.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.3.txt index 579e595c806..b8dc99ccf5b 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.3.txt @@ -7,4 +7,10 @@ class Animal { class Dog extends Animal { constructor(name, breed) { super(name); - this.breed = breed; \ No newline at end of file + this.breed = breed; + } +} + +const dog = new Dog('Rex', 'Labrador'); +console.log(dog.name); // Rex +console.log(dog.breed); // Labrador \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.4.txt new file mode 100644 index 00000000000..e591241ad93 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.4.txt @@ -0,0 +1,16 @@ +class Animal { + constructor(name) { + this.name = name; + } +} + +class Dog extends Animal { + constructor(name, breed) { + super(name); + this.breed = breed; + } +} + +const dog = new Dog("Buddy", "Golden Retriever"); +console.log(dog.name); // Output: Buddy +console.log(dog.breed); // Output: Golden Retriever \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.5.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.5.txt index 7b6b90969b6..5a172950f31 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.5.txt @@ -7,4 +7,9 @@ class Animal { class Dog extends Animal { constructor(name, breed) { super(name); - <<>> \ No newline at end of file + this.breed = breed; + } +} + +const dog = new Dog('Rex', 'Labrador'); +console.log(dog); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.9.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.6.txt similarity index 54% rename from src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.9.txt rename to src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.6.txt index 2a60be1e1fb..1917d7ca667 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.6.txt @@ -1,11 +1,16 @@ class Animal { constructor(name) { this.name = name; - this.breed = breed; } } class Dog extends Animal { constructor(name, breed) { super(name); - this.breed = breed; \ No newline at end of file + this.breed = breed; + } +} + +const dog = new Dog('Max', 'Labrador'); +console.log(dog.name); // Output: Max +console.log(dog.breed); // Output: Labrador \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.7.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.7.txt index 2c8b368d2a6..7a1d95344f6 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.7.txt @@ -8,4 +8,10 @@ class Dog extends Animal { constructor(name, breed) { super(name); this.breed = breed; - } \ No newline at end of file + } +} + +const dog = new Dog("Buddy", "Golden Retriever"); + +console.log(dog.name); // Output: Buddy +console.log(dog.breed); // Output: Golden Retriever \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.8.txt index 5115420fa25..7ef90fc7e3e 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.approved.8.txt @@ -1,7 +1,6 @@ class Animal { constructor(name) { - super(name); - this.breed = breed; + this.name = name; } } @@ -9,4 +8,9 @@ class Dog extends Animal { constructor(name, breed) { super(name); this.breed = breed; - <<>> \ No newline at end of file + } +} + +const dog = new Dog('Max', 'Labrador'); +console.log(dog.name); // Max +console.log(dog.breed); // Labrador \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.1.txt index 96ee1d819b1..75991601ef8 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.1.txt @@ -7,4 +7,6 @@ end class Dog < Animal def initialize(name, breed) super(name) - @breed = breed \ No newline at end of file + @breed = breed + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.2.txt similarity index 54% rename from src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.rejected.2.txt rename to src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.2.txt index 0648dba5917..d6200dff4e5 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.2.txt @@ -6,4 +6,10 @@ end class Dog < Animal def initialize(name, breed) - <<>> \ No newline at end of file + super(name) + @breed = breed + end +end + +dog = Dog.new("Fido", "Beagle") +puts dog.inspect \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.3.txt index 08c6904f85b..aa6ce14d798 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.3.txt @@ -6,4 +6,9 @@ end class Dog < Animal def initialize(name, breed) - super(name) \ No newline at end of file + super(name) + @breed = breed + end +end + +dog = Dog.new("Fido", "Poodle") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.4.txt new file mode 100644 index 00000000000..6ce23c5cf2a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.4.txt @@ -0,0 +1,22 @@ +class Animal + def initialize(name) + @name = name + end +end + +class Dog < Animal + def initialize(name, breed) + super(name) + @breed = breed + end +end + +class Cat < Animal + def initialize(name, color) + super(name) + @color = color + end +end + +dog = Dog.new("Fido", "Golden Retriever") +cat = Cat.new("Whiskers", "Black") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.5.txt index 2419e5a7b1f..06ebdcce2dd 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.5.txt @@ -8,4 +8,7 @@ class Dog < Animal def initialize(name, breed) super(name) @breed = breed - end \ No newline at end of file + end +end + +dog = Dog.new("Fido", "Beagle") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.6.txt index 75991601ef8..065ca0e43c7 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.6.txt @@ -9,4 +9,11 @@ class Dog < Animal super(name) @breed = breed end +end + +class Cat < Animal + def initialize(name, color) + super(name) + @color = color + end end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.7.txt index 065ca0e43c7..fd48c1e6781 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.7.txt @@ -11,9 +11,5 @@ class Dog < Animal end end -class Cat < Animal - def initialize(name, color) - super(name) - @color = color - end -end \ No newline at end of file +dog = Dog.new("Rex", "German Shepherd") +puts dog.inspect \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.8.txt new file mode 100644 index 00000000000..61b5f5f74f1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.8.txt @@ -0,0 +1,25 @@ +class Animal + def initialize(name) + @name = name + end +end + +class Dog < Animal + def initialize(name, breed) + super(name) + @breed = breed + end +end + +class Cat < Animal + def initialize(name, color) + super(name) + @color = color + end +end + +dog = Dog.new("Fido", "Golden Retriever") +cat = Cat.new("Whiskers", "Black") + +puts dog.inspect +puts cat.inspect \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.9.txt similarity index 56% rename from src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.rejected.4.txt rename to src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.9.txt index 4270bd3289e..4e3414cd7d8 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rb.approved.9.txt @@ -6,5 +6,9 @@ end class Dog < Animal def initialize(name, breed) - <<>> - super(name) \ No newline at end of file + super(name) + @breed = breed + end +end + +dog = Dog.new("Fido", "Golden Retriever") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.2.txt deleted file mode 100644 index 2a41222722c..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.2.txt +++ /dev/null @@ -1 +0,0 @@ -(no changes parsed) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.4.txt deleted file mode 100644 index 8363309ed2a..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.4.txt +++ /dev/null @@ -1,9 +0,0 @@ -class Animal { - constructor(name) { - this.name = name; - } -} - -class Dog extends Animal { - constructor(name, breed) { - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.6.txt deleted file mode 100644 index 020090de036..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-inheritance.rejected.6.txt +++ /dev/null @@ -1,10 +0,0 @@ -class Animal { - constructor(name) { - this.name = name; - } -} - -class Dog extends Animal { - constructor(name, breed) { - super(name); - this.breed = breed; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.1.txt index df24129c3d8..23ae142bc66 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.1.txt @@ -12,4 +12,6 @@ class Rectangle extends Shape { } area() { - return this.width * this.height; \ No newline at end of file + return this.width * this.height; + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.3.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.3.txt deleted file mode 100644 index 83802dedca9..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.3.txt +++ /dev/null @@ -1,15 +0,0 @@ -class Shape { - area() { - return this.width * this.height;0; - } -} - -class Rectangle extends Shape { - constructor(width, height) { - super(); - this.width = width; - this.height = height; - } - - area() { - return <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.4.txt deleted file mode 100644 index 407e8a14366..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.4.txt +++ /dev/null @@ -1,15 +0,0 @@ -class Shape { - area() { - return 0; - } -} - -class Rectangle extends Shape { - constructor(width, height) { - super(); - this.width = width; - this.height = height; - } - - area() { - return this.width * this.height \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.5.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.5.txt deleted file mode 100644 index 23ae142bc66..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.approved.5.txt +++ /dev/null @@ -1,17 +0,0 @@ -class Shape { - area() { - return 0; - } -} - -class Rectangle extends Shape { - constructor(width, height) { - super(); - this.width = width; - this.height = height; - } - - area() { - return this.width * this.height; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.1.txt index 5297b813562..22b62bf09a5 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.1.txt @@ -11,4 +11,36 @@ class Rectangle < Shape end def area - @width * @height \ No newline at end of file + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +rectangle = Rectangle.new(5, 10) +puts "Rectangle area: #{rectangle.area}" + +circle = Circle.new(7) +puts "Circle area: #{circle.area}" + +triangle = Triangle.new(8, 6) +puts "Triangle area: #{triangle.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.10.txt new file mode 100644 index 00000000000..f2ef098fbfc --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.10.txt @@ -0,0 +1,53 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +rectangle = Rectangle.new(10, 20) +circle = Circle.new(10) +triangle = Triangle.new(10, 20) +square = Square.new(10) + +puts rectangle.area +puts circle.area +puts triangle.area +puts square.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.11.txt new file mode 100644 index 00000000000..a9b9a60428a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.11.txt @@ -0,0 +1,46 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +rectangle = Rectangle.new(10, 20) +puts rectangle.area + +circle = Circle.new(10) +puts circle.area + +triangle = Triangle.new(10, 20) +puts triangle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.12.txt new file mode 100644 index 00000000000..eb2f13460bf --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.12.txt @@ -0,0 +1,46 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + @radius * @radius * Math::PI + end +end + +rectangle = Rectangle.new(10, 20) +puts rectangle.area + +triangle = Triangle.new(10, 20) +puts triangle.area + +circle = Circle.new(10) +puts circle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.13.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.13.txt new file mode 100644 index 00000000000..6b18f98da28 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.13.txt @@ -0,0 +1,41 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +rectangle = Rectangle.new(10, 20) +puts rectangle.area + +square = Square.new(10) +puts square.area + +circle = Circle.new(10) +puts circle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.14.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.14.txt new file mode 100644 index 00000000000..43e4e6e1085 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.14.txt @@ -0,0 +1,55 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +rectangle = Rectangle.new(10, 20) +puts "Rectangle area: #{rectangle.area}" + +square = Square.new(10) +puts "Square area: #{square.area}" + +circle = Circle.new(10) +puts "Circle area: #{circle.area}" + +triangle = Triangle.new(10, 20) +puts "Triangle area: #{triangle.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.15.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.15.txt new file mode 100644 index 00000000000..3b9fa6f29f4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.15.txt @@ -0,0 +1,46 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + 3.14 * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + 0.5 * @base * @height + end +end + +rectangle = Rectangle.new(10, 20) +puts rectangle.area + +circle = Circle.new(10) +puts circle.area + +triangle = Triangle.new(10, 20) +puts triangle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.16.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.16.txt new file mode 100644 index 00000000000..162b76ef3de --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.16.txt @@ -0,0 +1,57 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * (@radius ** 2) + end +end + +class AreaCalculator + def initialize(shapes) + @shapes = shapes + end + + def sum + @shapes.sum(&:area) + end +end + +shapes = [Rectangle.new(2, 3), Square.new(2), Triangle.new(2, 3), Circle.new(2)] +area_calculator = AreaCalculator.new(shapes) +puts area_calculator.sum \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.17.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.17.txt new file mode 100644 index 00000000000..b330f828f40 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.17.txt @@ -0,0 +1,55 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +rectangle = Rectangle.new(10, 20) +puts "Rectangle area: #{rectangle.area}" + +circle = Circle.new(10) +puts "Circle area: #{circle.area}" + +triangle = Triangle.new(10, 20) +puts "Triangle area: #{triangle.area}" + +square = Square.new(10) +puts "Square area: #{square.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.18.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.18.txt new file mode 100644 index 00000000000..dff57891654 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.18.txt @@ -0,0 +1,32 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +rectangle = Rectangle.new(10, 20) +circle = Circle.new(10) + +puts rectangle.area +puts circle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.19.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.19.txt new file mode 100644 index 00000000000..55e6fa546c1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.19.txt @@ -0,0 +1,45 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius ** 2 + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +rectangle = Rectangle.new(5, 10) +circle = Circle.new(7) +triangle = Triangle.new(4, 6) + +puts "Rectangle area: #{rectangle.area}" +puts "Circle area: #{circle.area}" +puts "Triangle area: #{triangle.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.2.txt new file mode 100644 index 00000000000..9f69def6dfb --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.2.txt @@ -0,0 +1,45 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +rectangle = Rectangle.new(10, 20) +circle = Circle.new(10) +triangle = Triangle.new(10, 20) + +puts rectangle.area +puts circle.area +puts triangle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.20.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.20.txt new file mode 100644 index 00000000000..92cc635cd97 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.20.txt @@ -0,0 +1,57 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + @radius * @radius * Math::PI + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class AreaCalculator + def initialize(shapes) + @shapes = shapes + end + + def sum + @shapes.reduce(0) { |sum, shape| sum + shape.area } + end +end + +shapes = [Rectangle.new(2, 3), Circle.new(5), Triangle.new(2, 3), Square.new(4)] +calculator = AreaCalculator.new(shapes) +puts calculator.sum \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.21.txt similarity index 70% rename from src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.7.txt rename to src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.21.txt index d451833df99..241a5ed3706 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.21.txt @@ -36,22 +36,10 @@ class Triangle < Shape end end -class Square < Shape - def initialize(side) - @side = side - end - - def area - @side * @side - end -end - rectangle = Rectangle.new(5, 10) circle = Circle.new(7) -triangle = Triangle.new(8, 12) -square = Square.new(6) +triangle = Triangle.new(4, 6) puts "Area of Rectangle: #{rectangle.area}" puts "Area of Circle: #{circle.area}" -puts "Area of Triangle: #{triangle.area}" -puts "Area of Square: #{square.area}" \ No newline at end of file +puts "Area of Triangle: #{triangle.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.22.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.22.txt new file mode 100644 index 00000000000..a6cbbb7cada --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.22.txt @@ -0,0 +1,55 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +rectangle = Rectangle.new(2, 3) +puts rectangle.area + +square = Square.new(2) +puts square.area + +circle = Circle.new(2) +puts circle.area + +triangle = Triangle.new(2, 3) +puts triangle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.23.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.23.txt new file mode 100644 index 00000000000..6f28a806aa5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.23.txt @@ -0,0 +1,45 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + 3.14 * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + 0.5 * @base * @height + end +end + +rectangle = Rectangle.new(10, 20) +circle = Circle.new(10) +triangle = Triangle.new(10, 20) + +puts rectangle.area +puts circle.area +puts triangle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.24.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.24.txt new file mode 100644 index 00000000000..d48595266ed --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.24.txt @@ -0,0 +1,45 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + 0.5 * @base * @height + end +end + +rectangle = Rectangle.new(5, 10) +circle = Circle.new(7) +triangle = Triangle.new(4, 6) + +puts "Rectangle Area: #{rectangle.area}" +puts "Circle Area: #{circle.area}" +puts "Triangle Area: #{triangle.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.3.txt index 6e9839844cd..bec6ff5e11a 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.3.txt @@ -13,4 +13,20 @@ class Rectangle < Shape def area @width * @height end -end \ No newline at end of file +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + 3.14 * @radius * @radius + end +end + +rectangle = Rectangle.new(10, 20) +puts rectangle.area + +circle = Circle.new(10) +puts circle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.4.txt new file mode 100644 index 00000000000..98ba6698aab --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.4.txt @@ -0,0 +1,32 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + 3.14 * @radius * @radius + end +end + +rectangle = Rectangle.new(10, 20) +circle = Circle.new(10) + +puts rectangle.area +puts circle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.5.txt index 93ce2595e2a..c4dce7e8384 100644 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.5.txt @@ -12,4 +12,35 @@ class Rectangle < Shape def area @width * @height - end \ No newline at end of file + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + 0.5 * @base * @height + end +end + +rectangle = Rectangle.new(5, 10) +puts "Rectangle area: #{rectangle.area}" + +circle = Circle.new(7) +puts "Circle area: #{circle.area}" + +triangle = Triangle.new(8, 6) +puts "Triangle area: #{triangle.area}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.6.txt new file mode 100644 index 00000000000..9481a0c89cb --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.6.txt @@ -0,0 +1,45 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +rectangle = Rectangle.new(10, 20) +circle = Circle.new(10) +triangle = Triangle.new(10, 20) + +puts rectangle.area +puts circle.area +puts triangle.area \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.8.txt new file mode 100644 index 00000000000..cce2d354682 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.approved.8.txt @@ -0,0 +1,57 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius**2 + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +class AreaCalculator + def initialize(shapes) + @shapes = shapes + end + + def sum + @shapes.sum(&:area) + end +end + +shapes = [Rectangle.new(10, 20), Square.new(10), Circle.new(10), Triangle.new(10, 20)] +calculator = AreaCalculator.new(shapes) +puts calculator.sum \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.2.txt deleted file mode 100644 index 07a05fc0812..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.2.txt +++ /dev/null @@ -1,14 +0,0 @@ -class Shape - def area - 0 - end -end - -class Rectangle < Shape - def initialize(width, height) - @width = width - @height = height - end - - def area - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.4.txt deleted file mode 100644 index 7b86a572658..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.4.txt +++ /dev/null @@ -1,16 +0,0 @@ -class Shape - def area - 0 - end -end - -class Rectangle < Shape - def initialize(width, height) - @width = width - @height = height - end - - def area - - @width * @height - end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.6.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.6.txt deleted file mode 100644 index ea0ddf96792..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.6.txt +++ /dev/null @@ -1,17 +0,0 @@ -class Shape - def area - 0 - end -end - -class Rectangle < Shape - def initialize(width, height) - @width = width - @height = height - end - - def area - - @width * @height - end -end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.7.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.7.txt new file mode 100644 index 00000000000..fd2a457c3c7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.7.txt @@ -0,0 +1,70 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + (@base * @height) / 2 + end +end + +class Ellipse < Shape + def initialize(axis1, axis2) + @axis1 = axis1 + @axis2 = axis2 + end + + def area + Math::PI * @axis1 * @axis2 + end +end + +class Trapezoid < Shape + def initialize(base1, base2, height) + @base1 = base1 + @base2 = base2 + @height = height + end + + def area + (@base1 + @base2) * @height / 2 + end +end + +class Parallelogram < Shape + def initialize(base, height) + @ \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.9.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.9.txt new file mode 100644 index 00000000000..7d0c58f01e4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rb.rejected.9.txt @@ -0,0 +1,71 @@ +class Shape + def area + 0 + end +end + +class Rectangle < Shape + def initialize(width, height) + @width = width + @height = height + end + + def area + @width * @height + end +end + +class Square < Rectangle + def initialize(side) + super(side, side) + end +end + +class Circle < Shape + def initialize(radius) + @radius = radius + end + + def area + Math::PI * @radius * @radius + end +end + +class Triangle < Shape + def initialize(base, height) + @base = base + @height = height + end + + def area + @base * @height / 2 + end +end + +class Ellipse < Shape + def initialize(a, b) + @a = a + @b = b + end + + def area + Math::PI * @a * @b + end +end + +class Trapezoid < Shape + def initialize(base1, base2, height) + @base1 = base1 + @base2 = base2 + @height = height + end + + def area + (@base1 + @base2) * @height / 2 + end +end + +class Parallelogram < Shape + def initialize(base, height) + @base = base + @height = \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rejected.2.txt b/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rejected.2.txt deleted file mode 100644 index 88756e24045..00000000000 --- a/src/test-llm-autocompletion/approvals/class-patterns/class-method-override.rejected.2.txt +++ /dev/null @@ -1,15 +0,0 @@ -class Shape { - area() { - return 0; - } -} - -class Rectangle extends Shape { - constructor(width, height) { - super(); - this.width = width; - this.height = height; - } - - area() { - return <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.1.txt index 4185f890d25..cda8aa7f235 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.1.txt @@ -1,7 +1,7 @@ function divide(a, b) { // FIXME: Handle division by zero if (b === 0) { - throw new Error('Division by zero is not allowed'); + throw new Error("Division by zero is not allowed"); } return a / b; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.10.txt deleted file mode 100644 index f4e622f9f7a..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.10.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a: number, b: number): number { - if (b === 0) { - throw new Error('Division by zero is not allowed'); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.11.txt deleted file mode 100644 index 27277124f04..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.11.txt +++ /dev/null @@ -1,7 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zero - if (b === 0) { - throw new Error("Division by zero"); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.12.txt deleted file mode 100644 index ac3a391ddd2..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.12.txt +++ /dev/null @@ -1,7 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zero - if (b === 0) { - throw new Error("Division by zero is not allowed"); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.3.txt deleted file mode 100644 index cda8aa7f235..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.3.txt +++ /dev/null @@ -1,7 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zero - if (b === 0) { - throw new Error("Division by zero is not allowed"); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.5.txt deleted file mode 100644 index 003ef05b432..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.5.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a, b) { - if (b === 0) { - throw new Error('Division by zero is not allowed'); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.8.txt deleted file mode 100644 index 2aef3e9cc5c..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.approved.8.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a, b) { - if (b === 0) { - throw new Error("Division by zero is not allowed"); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.2.txt deleted file mode 100644 index 83f07b2c5c0..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.2.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zeroif (b === 0) { - throw new Error("Division by zero"); -} - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.4.txt deleted file mode 100644 index 181cb8ed9fc..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.4.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zero\n if (b === 0) { - throw new Error("Division by zero is not allowed"); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.6.txt deleted file mode 100644 index bd35a7b2614..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.6.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zeroif (b === 0) { - throw new Error('Division by zero'); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.7.txt deleted file mode 100644 index ff441073456..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.7.txt +++ /dev/null @@ -1,6 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zero if (b === 0) { - throw new Error("Division by zero is not allowed"); - } - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.9.txt deleted file mode 100644 index 939f00594d0..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/fixme-bug.rejected.9.txt +++ /dev/null @@ -1,8 +0,0 @@ -function divide(a, b) { - // FIXME: Handle division by zero { - if (b === 0) { - throw new Error("Division by zero is not allowed"); - } -} - return a / b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.1.txt index f991815b04a..b03057e6205 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.1.txt @@ -1,4 +1,21 @@ // Implement functino to add two numbers -function add(a, b) { - return a + b; +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You may use bitwise operators + +#include + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a = 5, b = 7; + std::cout << "Sum of " << a << " and " << b << " is " << add(a, b) << std::endl; + return 0; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.10.txt new file mode 100644 index 00000000000..120c187626a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.10.txt @@ -0,0 +1,18 @@ +// Implement functino to add two numbers + +#include +using namespace std; + +int add(int a, int b) +{ + return a + b; +} + +int main() +{ + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum of " << a << " and " << b << " is " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.11.txt new file mode 100644 index 00000000000..3f68c46b9f7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.11.txt @@ -0,0 +1,21 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You are not allowed to use bitwise operators + +#include + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a = 5, b = 7; + std::cout << "Sum of " << a << " and " << b << " is " << add(a, b) << std::endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.12.txt new file mode 100644 index 00000000000..62a63a58b0c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.12.txt @@ -0,0 +1,25 @@ +// Implement functino to add two numbers +// 1. Using + operator +// 2. Using bitwise operator + +#include + +using namespace std; + +int add(int a, int b) { + int carry; + while (b != 0) { + carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum of " << a << " and " << b << " is " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.13.txt new file mode 100644 index 00000000000..7209d64bc4d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.13.txt @@ -0,0 +1,31 @@ +// Implement functino to add two numbers + +function addTwoNumbers(num1, num2) { + return num1 + num2; +} + +console.log(addTwoNumbers(2, 3)); + +// Implement function to multiply two numbers + +function multiplyTwoNumbers(num1, num2) { + return num1 * num2; +} + +console.log(multiplyTwoNumbers(2, 3)); + +// Implement function to divide two numbers + +function divideTwoNumbers(num1, num2) { + return num1 / num2; +} + +console.log(divideTwoNumbers(6, 3)); + +// Implement function to subtract two numbers + +function subtractTwoNumbers(num1, num2) { + return num1 - num2; +} + +console.log(subtractTwoNumbers(6, 3)); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.14.txt new file mode 100644 index 00000000000..73e0e3324c0 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.14.txt @@ -0,0 +1,24 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a = 10; + int b = 20; + + cout << add(a, b) << endl; + + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.15.txt new file mode 100644 index 00000000000..51f067286c6 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.15.txt @@ -0,0 +1,23 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators + +#include + +using namespace std; + +int add(int a, int b) { + if (b == 0) { + return a; + } + int sum = a ^ b; + int carry = (a & b) << 1; + return add(sum, carry); +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum: " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.16.txt new file mode 100644 index 00000000000..e5d4893b3e1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.16.txt @@ -0,0 +1,51 @@ +// Implement functino to add two numbers +// Input: 2, 3 +// Output: 5 + +function add(a, b) { + return a + b; +} + +console.log(add(2, 3)); + +// Implement function to subtract two numbers +// Input: 2, 3 +// Output: -1 + +function subtract(a, b) { + return a - b; +} + +console.log(subtract(2, 3)); + +// Implement function to multiply two numbers +// Input: 2, 3 +// Output: 6 + +function multiply(a, b) { + return a * b; +} + +console.log(multiply(2, 3)); + +// Implement function to divide two numbers +// Input: 2, 3 +// Output: 0.6666666666666666 + +function divide(a, b) { + return a / b; +} + +console.log(divide(2, 3)); + +// Implement function to calculate the remainder of two numbers +// Input: 2, 3 +// Output: 2 + +function remainder(a, b) { + return a % b; +} + +console.log(remainder(2, 3)); + +// Implement function to calculate the \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.18.txt new file mode 100644 index 00000000000..3ac64396138 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.18.txt @@ -0,0 +1,14 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators + +// Solution 1: Using bitwise operators +// Time: O(1) +// Space: O(1) +function add(a, b) { + while (b !== 0) { + let carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.19.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.19.txt new file mode 100644 index 00000000000..863b510a157 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.19.txt @@ -0,0 +1,23 @@ +// Implement functino to add two numbers +// You are not allowed to use the + and - operator + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum: " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.2.txt new file mode 100644 index 00000000000..a320d916096 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.2.txt @@ -0,0 +1,23 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operator +// You are not allowed to use incr/decr operator +// You are not allowed to use bitwise operator + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a = 5, b = 7; + cout << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.20.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.20.txt new file mode 100644 index 00000000000..231740f7808 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.20.txt @@ -0,0 +1,35 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You may use bitwise operators + +#include + +using namespace std; + +int add(int a, int b) +{ + int sum = a ^ b; + int carry = a & b; + + while (carry != 0) + { + carry = carry << 1; + int temp = sum ^ carry; + carry = sum & carry; + sum = temp; + } + + return sum; +} + +int main() +{ + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + + cout << "Sum of " << a << " and " << b << " is " << add(a, b) << endl; + + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.21.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.21.txt new file mode 100644 index 00000000000..87a96f1989c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.21.txt @@ -0,0 +1,22 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators + +#include +using namespace std; + +int add(int a, int b) { + while(b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum: " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.22.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.22.txt new file mode 100644 index 00000000000..3452fcaf5dd --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.22.txt @@ -0,0 +1,23 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You may use bitwise operators + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a = 10, b = 20; + cout << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.23.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.23.txt new file mode 100644 index 00000000000..a58768b0add --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.23.txt @@ -0,0 +1,24 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You may use bitwise operators +// You may use any number of variables + +#include + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + std::cout << "Enter two numbers: "; + std::cin >> a >> b; + std::cout << "Sum: " << add(a, b) << std::endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.24.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.24.txt new file mode 100644 index 00000000000..597f7452ada --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.24.txt @@ -0,0 +1,23 @@ +// Implement functino to add two numbers +// without using + operator + +#include +using namespace std; + +int add(int a, int b) +{ + while (b != 0) + { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() +{ + int a = 10, b = 20; + cout << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.25.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.25.txt new file mode 100644 index 00000000000..05c8fa49098 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.25.txt @@ -0,0 +1,22 @@ +// Implement functino to add two numbers without using + operator + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum: " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.26.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.26.txt new file mode 100644 index 00000000000..c0a316159f9 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.26.txt @@ -0,0 +1,19 @@ +// Implement functino to add two numbers +// without using + operator + +#include + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a = 5, b = 7; + std::cout << "Sum of " << a << " and " << b << " is " << add(a, b) << std::endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.3.txt similarity index 100% rename from src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.3.txt rename to src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.3.txt diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.4.txt new file mode 100644 index 00000000000..9c0142de728 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.4.txt @@ -0,0 +1,25 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You are not allowed to use bitwise operators + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum: " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.5.txt new file mode 100644 index 00000000000..9b24a5100c7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.5.txt @@ -0,0 +1,19 @@ +// Implement functino to add two numbers + +#include + +using namespace std; + +int add(int a, int b) +{ + return a + b; +} + +int main() +{ + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum of " << a << " and " << b << " is " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.6.txt new file mode 100644 index 00000000000..4aff70926c5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.6.txt @@ -0,0 +1,24 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators +// You are not allowed to use incr/decr operators +// You may use bitwise operators + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cin >> a >> b; + cout << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.7.txt new file mode 100644 index 00000000000..52e3b95e0cc --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.7.txt @@ -0,0 +1,16 @@ +// Implement functino to add two numbers + +#include + +using namespace std; + +int add(int a, int b) { + return a + b; +} + +int main() { + int a, b; + cin >> a >> b; + cout << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.8.txt new file mode 100644 index 00000000000..68e786f047a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.8.txt @@ -0,0 +1,15 @@ +// Implement functino to add two numbers + +function addTwoNumbers(num1, num2) { + return num1 + num2; +} + +console.log(addTwoNumbers(2, 3)); + +// Implement function to multiply two numbers + +function multiplyTwoNumbers(num1, num2) { + return num1 * num2; +} + +console.log(multiplyTwoNumbers(2, 3)); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.9.txt new file mode 100644 index 00000000000..03d5b0c9ef3 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.approved.9.txt @@ -0,0 +1,23 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operators + +#include + +using namespace std; + +int add(int a, int b) { + while (b != 0) { + int carry = a & b; + a = a ^ b; + b = carry << 1; + } + return a; +} + +int main() { + int a, b; + cout << "Enter two numbers: "; + cin >> a >> b; + cout << "Sum: " << add(a, b) << endl; + return 0; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.17.txt new file mode 100644 index 00000000000..f781918e3c8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.17.txt @@ -0,0 +1,22 @@ +// Implement functino to add two numbers +// You are not allowed to use + and - operator +// You are not allowed to use bitwise operator +// You are not allowed to use any loop / recursion + +// Solution +// 1. Use Math.abs() to get the absolute value of the difference between the two numbers +// 2. Use Math.sign() to get the sign of the difference between the two numbers +// 3. Use Math.pow() to get the power of the difference between the two numbers +// 4. Use Math.sqrt() to get the square root of the difference between the two numbers +// 5. Use Math.floor() to get the floor of the difference between the two numbers +// 6. Use Math.ceil() to get the ceil of the difference between the two numbers +// 7. Use Math.round() to get the round of the difference between the two numbers +// 8. Use Math.max() to get the maximum of the difference between the two numbers +// 9. Use Math.min() to get the minimum of the difference between the two numbers + +function addTwoNumbers(a, b) { + if (b === 0) { + return a; + } + let sum = a ^ b; + let carry \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.2.txt deleted file mode 100644 index 7a81b508c8f..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-add-numbers.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -// Implement functino to add two numbers { - return a + b; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.1.txt index c4358313810..e969618661a 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.1.txt @@ -8,8 +8,6 @@ function multiplyBy5(a) { } // Implement function to combine above functions - function combineFunctions(a, b) { - const sum = addNumbers(a, b); - return multiplyBy5(sum); + return multiplyBy5(addNumbers(a, b)) } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.2.txt index e4833196ed0..1afb95762b5 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.2.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.2.txt @@ -8,6 +8,9 @@ function multiplyBy5(a) { } // Implement function to combine above functions -function combineFunctions(a, b) { - return multiplyBy5(addNumbers(a, b)); -} \ No newline at end of file +function combineFunctions(a, b, func) { + return func(a, b) +} + +console.log(combineFunctions(1, 2, addNumbers)) +console.log(combineFunctions(1, 2, multiplyBy5)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.3.txt index 877a76efa86..edc86a91000 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.3.txt @@ -8,7 +8,6 @@ function multiplyBy5(a) { } // Implement function to combine above functions -function combinedFunction(a, b) { - const sum = addNumbers(a, b); - return multiplyBy5(sum); +function combine(a, b) { + return multiplyBy5(addNumbers(a, b)) } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.4.txt index d087822bc65..cd53e4db496 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.4.txt @@ -8,7 +8,9 @@ function multiplyBy5(a) { } // Implement function to combine above functions +// addNumbers and multiplyBy5 +// such that the result of addNumbers is multiplied by 5 -function combineFunctions(a, b) { - return multiplyBy5(addNumbers(a, b)); +function combine(a, b) { + return multiplyBy5(addNumbers(a, b)) } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.5.txt index edc86a91000..3b7c7579613 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/implement-function-combine-functions.approved.5.txt @@ -8,6 +8,6 @@ function multiplyBy5(a) { } // Implement function to combine above functions -function combine(a, b) { +function addAndMultiplyBy5(a, b) { return multiplyBy5(addNumbers(a, b)) } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.10.txt deleted file mode 100644 index c0809eb1f59..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.10.txt +++ /dev/null @@ -1,14 +0,0 @@ -class DataService { - private cache: Map = new Map(); - - // TODO: Implement caching mechanism to reduce API calls - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.11.txt index 19e37dc9b9d..38b4684e74a 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.11.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.11.txt @@ -1,13 +1,10 @@ class DataService { - private cache = new Map(); + // TODO: Implement caching mechanism to reduce API calls + constructor() { + this.cache = {}; + } async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; + return await api.get(`/data/${id}`); } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.12.txt index 315ad3888c7..c0e3ff646df 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.12.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.12.txt @@ -1,16 +1,9 @@ class DataService { // TODO: Implement caching mechanism to reduce API calls - private cache = new Map(); - - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; + constructor() { + this.cache = new Map(); } + async fetchData(id) { return await api.get(`/data/${id}`); } diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.13.txt deleted file mode 100644 index cb34559bcae..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.13.txt +++ /dev/null @@ -1,17 +0,0 @@ -class DataService { - // TODO: Implement caching mechanism to reduce API calls - private cache: Map = new Map(); - - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } - async fetchData(id) { - return await api.get(`/data/${id}`); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.3.txt deleted file mode 100644 index 332d87bd5ea..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.3.txt +++ /dev/null @@ -1,16 +0,0 @@ -class DataService { - private cache: Map = new Map(); - - // TODO: Implement caching mechanism to reduce API calls<<>> - async fetchData(id) { - const cacheKey = `data_${id}`; - - if (this.cache.has(cacheKey)) { - return this.cache.get(cacheKey); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(cacheKey, data); - return data; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.5.txt deleted file mode 100644 index 363a4b3a6aa..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.5.txt +++ /dev/null @@ -1,18 +0,0 @@ -class DataService { - constructor() { - this.cache = new Map(); - } - - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } - async fetchData(id) { - return await api.get(`/data/${id}`); - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.8.txt deleted file mode 100644 index f102502bfdd..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.8.txt +++ /dev/null @@ -1,14 +0,0 @@ -class DataService { - private cache = new Map(); - - // TODO: Implement caching mechanism to reduce API calls - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.9.txt deleted file mode 100644 index c0809eb1f59..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.9.txt +++ /dev/null @@ -1,14 +0,0 @@ -class DataService { - private cache: Map = new Map(); - - // TODO: Implement caching mechanism to reduce API calls - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.1.txt new file mode 100644 index 00000000000..df047172da4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.1.txt @@ -0,0 +1,9 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading state + // TODO: Implement retry mechanism + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.10.txt new file mode 100644 index 00000000000..c03cf8e7ae1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.10.txt @@ -0,0 +1,38 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading states + // TODO: Implement data validation + // TODO: Implement data transformation + // TODO: Implement data filtering + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data search + // TODO: Implement data export + // TODO: Implement data import + // TODO: Implement data synchronization + // TODO: Implement data backup + // TODO: Implement data restore + // TODO: Implement data migration + // TODO: Implement data analytics + // TODO: Implement data visualization + // TODO: Implement data reporting + // TODO: Implement data notifications + // TODO: Implement data logging + // TODO: Implement data monitoring + // TODO: Implement data security + // TODO: Implement data privacy + // TODO: Implement data compliance + // TODO: Implement data governance + // TODO: Implement data quality + // TODO: Implement data integrity + // TODO: Implement data consistency + // TODO: Implement data accuracy + // TODO: Implement data reliability + // TODO: Implement data availability + // TODO: Implement data performance + // TODO: Implement data scal + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.13.txt new file mode 100644 index 00000000000..0ccac635521 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.13.txt @@ -0,0 +1,8 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for failed API requests + // TODO: Implement data validation for API responses + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.14.txt new file mode 100644 index 00000000000..523b7f67f6d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.14.txt @@ -0,0 +1,8 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading state management + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.15.txt new file mode 100644 index 00000000000..d31d29d39b1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.15.txt @@ -0,0 +1,28 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for API calls + // TODO: Implement retry mechanism for failed API calls + // TODO: Implement rate limiting for API calls + // TODO: Implement request cancellation for pending API calls + // TODO: Implement request batching for multiple API calls + // TODO: Implement request prioritization for API calls + // TODO: Implement request deduplication for API calls + // TODO: Implement request merging for API calls + // TODO: Implement request queuing for API calls + // TODO: Implement request retry with exponential backoff for API calls + // TODO: Implement request timeout for API calls + // TODO: Implement request validation for API calls + // TODO: Implement request logging for API calls + // TODO: Implement request monitoring for API calls + // TODO: Implement request tracing for API calls + // TODO: Implement request metrics for API calls + // TODO: Implement request health checks for API calls + // TODO: Implement request circuit breaker for API calls + // TODO: Implement request fallback for API calls + // TODO: Implement request retry with jitter for API calls + // TODO: Implement request retry with circuit breaker for API calls + // TODO: Implement + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.16.txt similarity index 54% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.1.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.16.txt index b4410029ae3..3ce7a2c2093 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.16.txt @@ -1,12 +1,8 @@ class DataService { // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for API calls + // TODO: Implement data validation for API responses - private cache = new Map(); - - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } async fetchData(id) { return await api.get(`/data/${id}`); } diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.17.txt new file mode 100644 index 00000000000..06e96655ff8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.17.txt @@ -0,0 +1,9 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for API calls + // TODO: Implement rate limiting for API calls + + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.18.txt new file mode 100644 index 00000000000..94ef1398c5a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.18.txt @@ -0,0 +1,9 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for failed API calls + // TODO: Implement retry mechanism for failed API calls + // TODO: Implement rate limiting to avoid hitting API limits + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.19.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.19.txt new file mode 100644 index 00000000000..e3216355583 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.19.txt @@ -0,0 +1,8 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for failed API requests + + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.2.txt index f64b24a7cd6..e34af19ee98 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.2.txt @@ -1,5 +1,7 @@ class DataService { - // TODO: Implement caching mechanism to reduce API calls<<>> + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for API calls + // TODO: Implement data validation for API responses async fetchData(id) { return await api.get(`/data/${id}`); } diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.20.txt similarity index 100% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-caching.approved.14.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.20.txt diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.21.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.21.txt new file mode 100644 index 00000000000..745b2ac1dc5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.21.txt @@ -0,0 +1,10 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading states + // TODO: Implement data validation + + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.3.txt new file mode 100644 index 00000000000..af6a914d1f7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.3.txt @@ -0,0 +1,8 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling and retry logic + + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.4.txt index ad5e8a92db6..892619ed06c 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.4.txt @@ -1,17 +1,7 @@ class DataService { - // TODO: Implement caching mechanism to reduce API calls``` - private cache: Map = new Map(); - - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } -``` + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading state async fetchData(id) { return await api.get(`/data/${id}`); } diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.5.txt new file mode 100644 index 00000000000..b60176ca28d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.5.txt @@ -0,0 +1,8 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for API calls + + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.6.txt index 5b3bc0608da..5c98b289e26 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.6.txt @@ -1,17 +1,7 @@ class DataService { - // TODO: Implement caching mechanism to reduce API calls``` - private cache = new Map(); - - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } -``` + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling for API calls + // TODO: Implement loading state for API calls async fetchData(id) { return await api.get(`/data/${id}`); } diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.7.txt index e5b9c3105e3..e8bfd33e374 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.7.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.7.txt @@ -1,15 +1,9 @@ class DataService { - // TODO: Implement caching mechanism to reduce API callsprivate cache = new Map(); + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading state + // TODO: Implement retry mechanism - async fetchData(id) { - if (this.cache.has(id)) { - return this.cache.get(id); - } - - const data = await api.get(`/data/${id}`); - this.cache.set(id, data); - return data; - } async fetchData(id) { return await api.get(`/data/${id}`); } diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.8.txt new file mode 100644 index 00000000000..10b5329ccc2 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.8.txt @@ -0,0 +1,29 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading state + // TODO: Implement retry mechanism + // TODO: Implement timeout mechanism + // TODO: Implement request cancellation mechanism + // TODO: Implement request deduplication mechanism + // TODO: Implement request batching mechanism + // TODO: Implement request prioritization mechanism + // TODO: Implement request retry mechanism + // TODO: Implement request retry delay mechanism + // TODO: Implement request retry limit mechanism + // TODO: Implement request retry backoff mechanism + // TODO: Implement request retry jitter mechanism + // TODO: Implement request retry exponential backoff mechanism + // TODO: Implement request retry linear backoff mechanism + // TODO: Implement request retry constant backoff mechanism + // TODO: Implement request retry random backoff mechanism + // TODO: Implement request retry custom backoff mechanism + // TODO: Implement request retry custom backoff mechanism with jitter + // TODO: Implement request retry custom backoff mechanism with exponential backoff + // TODO: Implement request retry custom backoff mechanism with linear backoff + // TODO: Implement request retry custom backoff mechanism with constant backoff + // TODO: Implement request retry custom backoff + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.9.txt new file mode 100644 index 00000000000..0e8a0179ce8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-caching.rejected.9.txt @@ -0,0 +1,34 @@ +class DataService { + // TODO: Implement caching mechanism to reduce API calls + // TODO: Implement error handling + // TODO: Implement loading state + // TODO: Implement retry mechanism + // TODO: Implement timeout mechanism + // TODO: Implement request cancellation mechanism + // TODO: Implement request deduplication mechanism + // TODO: Implement request batching mechanism + // TODO: Implement request prioritization mechanism + // TODO: Implement request queuing mechanism + // TODO: Implement request retry mechanism + // TODO: Implement request timeout mechanism + // TODO: Implement request cancellation mechanism + // TODO: Implement request deduplication mechanism + // TODO: Implement request batching mechanism + // TODO: Implement request prioritization mechanism + // TODO: Implement request queuing mechanism + // TODO: Implement request retry mechanism + // TODO: Implement request timeout mechanism + // TODO: Implement request cancellation mechanism + // TODO: Implement request deduplication mechanism + // TODO: Implement request batching mechanism + // TODO: Implement request prioritization mechanism + // TODO: Implement request queuing mechanism + // TODO: Implement request retry mechanism + // TODO: Implement request timeout mechanism + // TODO: Implement request cancellation mechanism + // TODO: Implement request deduplication mechanism + // TODO + async fetchData(id) { + return await api.get(`/data/${id}`); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.1.txt deleted file mode 100644 index 96687da25c9..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.1.txt +++ /dev/null @@ -1,7 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - // Debounce the search function to prevent excessive API calls - const debouncedSearch = debounce(searchAPI, 500); - debouncedSearch(query); - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.11.txt deleted file mode 100644 index 81f078cb3c3..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.11.txt +++ /dev/null @@ -1,15 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debounce = (func, delay) => { - let timeoutId; - return (...args) => { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => { - func.apply(this, args); - }, delay); - }; - }; - - const debouncedSearch = debounce(searchAPI, 500); - debouncedSearch(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.13.txt deleted file mode 100644 index eef556d24c3..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.13.txt +++ /dev/null @@ -1,9 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debouncedSearch = debounce((query) => { - searchAPI(query); - }, 500); - - debouncedSearch(query); - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.17.txt deleted file mode 100644 index ee6bea311c3..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.17.txt +++ /dev/null @@ -1,9 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debounceTimer = setTimeout(() => { - searchAPI(query); - }, 500); - - return () => clearTimeout(debounceTimer); - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.19.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.19.txt deleted file mode 100644 index e7a5ffce8bd..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.19.txt +++ /dev/null @@ -1,9 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debounceTimer = setTimeout(() => { - searchAPI(query); - }, 500); - return () => clearTimeout(debounceTimer); - - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.20.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.20.txt deleted file mode 100644 index cd6c29bddc1..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.20.txt +++ /dev/null @@ -1,10 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - .then(data => { - // Handle search results - }) - .catch(error => { - console.error('Search failed:', error); - }); - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.3.txt deleted file mode 100644 index bd5b7e6bd53..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.3.txt +++ /dev/null @@ -1,17 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debounce = (func, delay) => { - let timeoutId; - return function(...args) { - if (timeoutId) { - clearTimeout(timeoutId); - } - timeoutId = setTimeout(() => { - func.apply(this, args); - }, delay); - }; - }; - - const debouncedSearch = debounce(searchAPI, 300); - debouncedSearch(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.5.txt deleted file mode 100644 index 4d89da14857..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.5.txt +++ /dev/null @@ -1,10 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debounceTimer = setTimeout(() => { - searchAPI(query); - }, 500); - - return () => clearTimeout(debounceTimer); -} - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.7.txt deleted file mode 100644 index 3393e7d1c85..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.7.txt +++ /dev/null @@ -1,9 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debounceTimer = setTimeout(() => { - searchAPI(query); - }, 500); - return () => clearTimeout(debounceTimer); -} - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.9.txt deleted file mode 100644 index 1df73c416d3..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.9.txt +++ /dev/null @@ -1,8 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - const debouncedSearch = debounce((query) => { - searchAPI(query); - }, 500); - - debouncedSearch(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.1.txt similarity index 57% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.15.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.1.txt index 4d834aaf293..bbf6c558e4d 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.15.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.1.txt @@ -1,6 +1,5 @@ function handleSearch(query) { // TODO: Add debounce to prevent excessive API calls - const debouncedSearch = debounce(searchAPI, 500); - debouncedSearch(query); + // TODO: Add error handling for API failures searchAPI(query); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.10.txt deleted file mode 100644 index fabb6ebb829..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.10.txt +++ /dev/null @@ -1,16 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls``` - const debounce = (func, delay) => { - let timeoutId; - return function(...args) { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => func.apply(this, args), delay); - }; - }; - - const debouncedSearch = debounce(searchAPI, 300); - - debouncedSearch(query); -``` - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.12.txt deleted file mode 100644 index ad5cf7c19f7..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.12.txt +++ /dev/null @@ -1,10 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls``` - const debounceTimer = setTimeout(() => { - searchAPI(query); - }, 500); - - return () => clearTimeout(debounceTimer); -``` - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.14.txt deleted file mode 100644 index 50cce59159e..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.14.txt +++ /dev/null @@ -1,15 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API callsconst debounce = (func, delay) => { - let timeoutId; - return (...args) => { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => { - func(...args); - }, delay); - }; - }; - - const debouncedSearch = debounce(searchAPI, 500); - debouncedSearch(query); - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.18.txt deleted file mode 100644 index d13480edae1..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.18.txt +++ /dev/null @@ -1,8 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls - let timeoutId; - clearTimeout(timeoutId); - timeoutId = setTimeout(() => searchAPI(query), 500); - - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.2.txt index 1df73c416d3..e2955a594b1 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.2.txt @@ -1,8 +1,6 @@ function handleSearch(query) { // TODO: Add debounce to prevent excessive API calls - const debouncedSearch = debounce((query) => { - searchAPI(query); - }, 500); - - debouncedSearch(query); + // TODO: Add loading state + // TODO: Add error handling + searchAPI(query); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.3.txt similarity index 70% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.16.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.3.txt index 87363c15c0c..75225715ca7 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.16.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.3.txt @@ -1,5 +1,5 @@ function handleSearch(query) { // TODO: Add debounce to prevent excessive API calls - .then(results => displayResults(results)); + // TODO: Add error handling for API calls searchAPI(query); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.4.txt index bb7f844dfe8..efb0fed97f2 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.4.txt @@ -1,4 +1,5 @@ function handleSearch(query) { // TODO: Add debounce to prevent excessive API calls + // TODO: Add error handling for failed API calls searchAPI(query); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.21.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.5.txt similarity index 100% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.approved.21.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.5.txt diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.6.txt index 0ad19449e1a..6a2c0b0eb2d 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.6.txt @@ -1,8 +1,5 @@ function handleSearch(query) { // TODO: Add debounce to prevent excessive API calls - const debouncedSearch = debounce((query) => { - searchAPI(query); - }, 300); - - debouncedSearch(query); + // TODO: Add error handling for invalid queries + searchAPI(query); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.8.txt deleted file mode 100644 index 74dfbf0c1be..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-debounce.rejected.8.txt +++ /dev/null @@ -1,10 +0,0 @@ -function handleSearch(query) { - // TODO: Add debounce to prevent excessive API calls``` - const debouncedSearch = debounce((query) => { - searchAPI(query); - }, 500); - - debouncedSearch(query); -``` - searchAPI(query); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.1.txt deleted file mode 100644 index e21651233b2..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.1.txt +++ /dev/null @@ -1,12 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - try { - const processedData = data.map(item => { - // Process each item - }); - } catch (error) { - console.error('Error processing data:', error); - throw error; - } - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.10.txt new file mode 100644 index 00000000000..1c7222ca7b6 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.10.txt @@ -0,0 +1,16 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + if (!data || typeof data !== 'object') { + throw new Error('Invalid data format'); + } + + // TODO: Implement data processing logic + const processedData = { + id: data.id, + name: data.name, + age: data.age, + email: data.email, + }; + + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.12.txt deleted file mode 100644 index f6dd98f3fd0..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.12.txt +++ /dev/null @@ -1,12 +0,0 @@ -function processData(data) { - if (!data) { - throw new Error('Data is required'); - } - - if (typeof data !== 'object') { - throw new Error('Data must be an object'); - } - - // TODO: Implement error handling - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.13.txt index d1054a96a22..d5b917d07dc 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.13.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.13.txt @@ -1,14 +1,10 @@ function processData(data) { - if (!data) { - throw new Error('Data is required'); - } - - try { - // Process the data here - const processedData = data; // Replace with actual processing logic - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; // Re-throw the error for the caller to handle - } + // TODO: Implement error handling for invalid data + const processedData = data.map((item) => { + if (typeof item !== 'number') { + throw new Error('Invalid data type. Expected number.'); + } + return item * 2; + }); + return processedData; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.14.txt deleted file mode 100644 index e8b867d5a5e..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.14.txt +++ /dev/null @@ -1,7 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - if (!data) { - throw new Error('Data is required'); - } - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.15.txt deleted file mode 100644 index 589eb9771cd..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.15.txt +++ /dev/null @@ -1,12 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - try { - // Process data here - const processedData = data.map(item => item * 2); - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; - } - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.16.txt deleted file mode 100644 index dff697e3f66..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.16.txt +++ /dev/null @@ -1,12 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - try { - // Process the data here - const processedData = data.map(item => item * 2); - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; - } - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.17.txt deleted file mode 100644 index 0cef1266089..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.17.txt +++ /dev/null @@ -1,13 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - - if (!data) { - throw new Error("Data is required"); - } - - const processedData = data.map(item => { - // Process each item - return item; - }); - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.18.txt deleted file mode 100644 index b990343d43a..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.18.txt +++ /dev/null @@ -1,13 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - try { - // Process the data here - const processedData = data.map(item => item * 2); - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; - } - - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.19.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.19.txt deleted file mode 100644 index 01a3a98562e..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.19.txt +++ /dev/null @@ -1,9 +0,0 @@ -function processData(data) { - // TODO: Implement error handling - if (!data) { - throw new Error("Data is required"); - } - const processedData = data.map(item => item * 2); - - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.2.txt new file mode 100644 index 00000000000..280f8185a0a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.2.txt @@ -0,0 +1,16 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + if (!data || typeof data !== 'object') { + throw new Error('Invalid data format'); + } + + // TODO: Implement data processing logic + const processedData = { + id: data.id, + name: data.name, + email: data.email, + // Add more fields as needed + }; + + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.3.txt index d7ee7d359c1..686eb422d3d 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.3.txt @@ -1,9 +1,22 @@ function processData(data) { - // TODO: Implement error handling - if (!data) { - throw new Error('Data is required'); + // TODO: Implement error handling for invalid data + if (!data || typeof data !== 'object') { + throw new Error('Invalid data format'); } - const processedData = data.map(item => item * 2); + // TODO: Implement data validation + if (!data.id || !data.name || !data.email) { + throw new Error('Missing required fields'); + } + + // TODO: Implement data processing logic + const processedData = { + id: data.id, + name: data.name.toUpperCase(), + email: data.email.toLowerCase(), + age: data.age || null, + address: data.address || null, + }; + return processedData; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.4.txt new file mode 100644 index 00000000000..82e36c8ec5e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.4.txt @@ -0,0 +1,17 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + if (!data || typeof data !== 'object') { + throw new Error('Invalid data format'); + } + + // TODO: Implement data processing logic + const processedData = data.map(item => { + // Example processing: Convert string values to uppercase + if (typeof item === 'string') { + return item.toUpperCase(); + } + return item; + }); + + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.5.txt index 938095b5a83..24b7897a211 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.5.txt @@ -1,13 +1,8 @@ function processData(data) { - if (!data) { - throw new Error('Data is required'); - } - - try { - // TODO: Implement error handling<<>> - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; - } + // TODO: Implement error handling for invalid data + const processedData = data.map(item => { + // TODO: Implement data processing logic + return item; + }); + return processedData; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.7.txt deleted file mode 100644 index f57a7e95dc8..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.7.txt +++ /dev/null @@ -1,5 +0,0 @@ -function processData(data) { - try { - // TODO: Implement error handling<<>> - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.8.txt new file mode 100644 index 00000000000..c63bc03f963 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.8.txt @@ -0,0 +1,16 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + if (!data || typeof data !== 'object') { + throw new Error('Invalid data format'); + } + + // TODO: Implement data processing logic + const processedData = {}; + for (const key in data) { + if (data.hasOwnProperty(key)) { + processedData[key] = data[key].toUpperCase(); + } + } + + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.9.txt index dffc8aebacc..b94561f22d8 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.approved.9.txt @@ -1,6 +1,20 @@ function processData(data) { - if (!data) { - throw new Error('Data is required'); - }<<>> + // TODO: Implement error handling for invalid data + if (!data || typeof data !== 'object') { + throw new Error('Invalid data format'); + } + + // TODO: Implement data validation + if (!data.name || !data.age || !data.email) { + throw new Error('Missing required fields'); + } + + // TODO: Implement data transformation + const processedData = { + fullName: data.name, + age: data.age, + email: data.email, + }; + return processedData; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.1.txt new file mode 100644 index 00000000000..2843cdc5ed7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.1.txt @@ -0,0 +1,36 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + // TODO: Implement data validation + // TODO: Implement data transformation + // TODO: Implement data enrichment + // TODO: Implement data filtering + // TODO: Implement data aggregation + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data caching + // TODO: Implement data compression + // TODO: Implement data encryption + // TODO: Implement data logging + // TODO: Implement data monitoring + // TODO: Implement data analytics + // TODO: Implement data visualization + // TODO: Implement data export + // TODO: Implement data import + // TODO: Implement data backup + // TODO: Implement data restore + // TODO: Implement data migration + // TODO: Implement data synchronization + // TODO: Implement data integration + // TODO: Implement data orchestration + // TODO: Implement data governance + // TODO: Implement data quality + // TODO: Implement data privacy + // TODO: Implement data security + // TODO: Implement data compliance + // TODO: Implement data audit + // TODO: Implement data lineage + // TODO: Implement data catalog + // TODO: Implement data dictionary + // TODO + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.10.txt deleted file mode 100644 index 57294a3779c..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.10.txt +++ /dev/null @@ -1,18 +0,0 @@ -function processData(data) { - // TODO: Implement error handling``` - try { - const processedData = data.map(item => { - if (!item || typeof item !== 'object') { - throw new Error('Invalid data item'); - } - // Process the item here - return processedItem; - }); - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; // Re-throw the error for the caller to handle - } -``` - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.11.txt index 8ab92d73b2c..f7ec35ae95f 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.11.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.11.txt @@ -1,28 +1,36 @@ function processData(data) { // TODO: Implement error handling for invalid data - // TODO: Implement data validation and sanitization - // TODO: Implement data transformation and enrichment - // TODO: Implement data aggregation and summarization - // TODO: Implement data filtering and sorting - // TODO: Implement data pagination and limit - // TODO: Implement data caching and optimization - // TODO: Implement data security and privacy - // TODO: Implement data logging and monitoring - // TODO: Implement data backup and recovery - // TODO: Implement data versioning and history - // TODO: Implement data integration and interoperability - // TODO: Implement data visualization and reporting - // TODO: Implement data analytics and machine learning - // TODO: Implement data governance and compliance - // TODO: Implement data quality and metadata management - // TODO: Implement data lineage and traceability - // TODO: Implement data catalog and discovery - // TODO: Implement data virtualization and federation - // TODO: Implement data streaming and real-time processing - // TODO: Implement data lake and data warehouse - // TODO: Implement data mesh and data fabric - // TODO: Implement data governance and data quality - // TODO: Implement data privacy and data security - // TODO: Implement data ethics + // TODO: Implement data validation + // TODO: Implement data transformation + // TODO: Implement data filtering + // TODO: Implement data aggregation + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data caching + // TODO: Implement data compression + // TODO: Implement data encryption + // TODO: Implement data decryption + // TODO: Implement data logging + // TODO: Implement data monitoring + // TODO: Implement data analytics + // TODO: Implement data visualization + // TODO: Implement data export + // TODO: Implement data import + // TODO: Implement data backup + // TODO: Implement data restore + // TODO: Implement data synchronization + // TODO: Implement data integration + // TODO: Implement data migration + // TODO: Implement data transformation + // TODO: Implement data validation + // TODO: Implement data filtering + // TODO: Implement data aggregation + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data caching + // TODO: Implement data compression + // TODO: Implement data encryption + // TODO: Implement data decryption + // return processedData; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.12.txt new file mode 100644 index 00000000000..607b24bf720 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.12.txt @@ -0,0 +1,36 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + // TODO: Implement data validation + // TODO: Implement data transformation + // TODO: Implement data enrichment + // TODO: Implement data filtering + // TODO: Implement data aggregation + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data caching + // TODO: Implement data logging + // TODO: Implement data monitoring + // TODO: Implement data analytics + // TODO: Implement data visualization + // TODO: Implement data reporting + // TODO: Implement data export + // TODO: Implement data import + // TODO: Implement data backup + // TODO: Implement data restore + // TODO: Implement data security + // TODO: Implement data privacy + // TODO: Implement data compliance + // TODO: Implement data governance + // TODO: Implement data quality + // TODO: Implement data lineage + // TODO: Implement data catalog + // TODO: Implement data dictionary + // TODO: Implement data glossary + // TODO: Implement data profiling + // TODO: Implement data lineage + // TODO: Implement data quality + // TODO: Implement data governance + // TODO: Implement data catalog + // TODO + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.14.txt new file mode 100644 index 00000000000..c8038998e8a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.14.txt @@ -0,0 +1,27 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + // TODO: Implement data validation and sanitization + // TODO: Implement data transformation and enrichment + // TODO: Implement data aggregation and summarization + // TODO: Implement data filtering and sorting + // TODO: Implement data caching and performance optimization + // TODO: Implement data security and privacy protection + // TODO: Implement data logging and monitoring + // TODO: Implement data backup and recovery + // TODO: Implement data versioning and change tracking + // TODO: Implement data integration and interoperability + // TODO: Implement data quality and accuracy assurance + // TODO: Implement data governance and compliance + // TODO: Implement data visualization and reporting + // TODO: Implement data analytics and machine learning + // TODO: Implement data-driven decision making and automation + // TODO: Implement data-driven innovation and transformation + // TODO: Implement data-driven business growth and success + // TODO: Implement data-driven digital transformation and innovation + // TODO: Implement data-driven business transformation and innovation + // TODO: Implement data-driven business growth and success + // TODO: Implement data-driven business transformation and innovation + // TODO: Implement data-driven business growth and success + // TODO: Implement data-driven + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.15.txt new file mode 100644 index 00000000000..9b181f13e2a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.15.txt @@ -0,0 +1,27 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + // TODO: Implement data validation and sanitization + // TODO: Implement data transformation and enrichment + // TODO: Implement data aggregation and summarization + // TODO: Implement data filtering and sorting + // TODO: Implement data caching and performance optimization + // TODO: Implement data security and privacy protection + // TODO: Implement data logging and monitoring + // TODO: Implement data backup and recovery + // TODO: Implement data versioning and change tracking + // TODO: Implement data integration and interoperability + // TODO: Implement data governance and compliance + // TODO: Implement data quality and accuracy assurance + // TODO: Implement data visualization and reporting + // TODO: Implement data analytics and machine learning + // TODO: Implement data-driven decision making and automation + // TODO: Implement data-driven innovation and transformation + + // Example data processing logic + const processedData = data.map(item => { + // TODO: Implement data processing logic + return item; + }); + + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.2.txt deleted file mode 100644 index 999c62b8844..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.2.txt +++ /dev/null @@ -1,4 +0,0 @@ -function processData(data) { - // TODO: Implement error handling<<>> - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.4.txt deleted file mode 100644 index f6dd98f3fd0..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.4.txt +++ /dev/null @@ -1,12 +0,0 @@ -function processData(data) { - if (!data) { - throw new Error('Data is required'); - } - - if (typeof data !== 'object') { - throw new Error('Data must be an object'); - } - - // TODO: Implement error handling - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.6.txt index 0f3c4a2a264..71b54c0fb2f 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.6.txt @@ -1,12 +1,36 @@ function processData(data) { - // TODO: Implement error handling``` - try { - const processedData = // ... existing processing logic - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; // or handle the error as needed - } -``` + // TODO: Implement error handling for invalid data + // TODO: Implement data validation + // TODO: Implement data transformation + // TODO: Implement data enrichment + // TODO: Implement data filtering + // TODO: Implement data aggregation + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data caching + // TODO: Implement data compression + // TODO: Implement data encryption + // TODO: Implement data logging + // TODO: Implement data monitoring + // TODO: Implement data analytics + // TODO: Implement data visualization + // TODO: Implement data export + // TODO: Implement data import + // TODO: Implement data backup + // TODO: Implement data restore + // TODO: Implement data synchronization + // TODO: Implement data integration + // TODO: Implement data migration + // TODO: Implement data transformation + // TODO: Implement data enrichment + // TODO: Implement data filtering + // TODO: Implement data aggregation + // TODO: Implement data sorting + // TODO: Implement data pagination + // TODO: Implement data caching + // TODO: Implement data compression + // TODO: Implement data encryption + // TODO: Implement data logging + // TODO: return processedData; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.7.txt new file mode 100644 index 00000000000..f69ee1612a5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.7.txt @@ -0,0 +1,32 @@ +function processData(data) { + // TODO: Implement error handling for invalid data + // TODO: Implement data validation and sanitization + // TODO: Implement data transformation and enrichment + // TODO: Implement data aggregation and summarization + // TODO: Implement data filtering and sorting + // TODO: Implement data caching and performance optimization + // TODO: Implement data security and privacy protection + // TODO: Implement data logging and monitoring + // TODO: Implement data backup and recovery + // TODO: Implement data versioning and change tracking + // TODO: Implement data integration and interoperability + // TODO: Implement data governance and compliance + // TODO: Implement data quality and accuracy assurance + // TODO: Implement data visualization and reporting + // TODO: Implement data analytics and machine learning + // TODO: Implement data-driven decision making and automation + // TODO: Implement data-driven innovation and transformation + // TODO: Implement data-driven business growth and success + + // Example implementation: + const processedData = data.map(item => { + // Transform and enrich data + item.processed = true; + item.timestamp = new Date().toISOString(); + return item; + }); + + // Filter and sort data + processedData.sort((a, b) => a.timestamp.locale + return processedData; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.8.txt deleted file mode 100644 index 09fea3ce690..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-error-handling.rejected.8.txt +++ /dev/null @@ -1,12 +0,0 @@ -function processData(data) { - // TODO: Implement error handling``` - try { - const processedData = // ... existing processing code ... - return processedData; - } catch (error) { - console.error('Error processing data:', error); - throw error; // or handle the error as needed - } -``` - return processedData; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.1.txt index 89f439e4735..a1be6f3543b 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.1.txt @@ -1,7 +1,7 @@ function processOrder(order) { // TODO: Add comprehensive logging for order processing console.log(`Processing order: ${JSON.stringify(order)}`); - + // TODO: Add validation for order data const result = validateOrder(order); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.10.txt index 94ce19a3f15..35f63cb7ce9 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.10.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.10.txt @@ -1,8 +1,8 @@ function processOrder(order) { + // TODO: Add comprehensive logging for order processing console.log(`Processing order: ${JSON.stringify(order)}`); - console.time('orderProcessing'); + // Simulate order processing logic + // ... const result = validateOrder(order); - console.timeEnd('orderProcessing'); - console.log(`Order processing result: ${JSON.stringify(result)}`); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.11.txt index c23857604fc..d310ee757ac 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.11.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.11.txt @@ -1,17 +1,7 @@ function processOrder(order) { + // TODO: Add comprehensive logging for order processing console.log(`Processing order: ${JSON.stringify(order)}`); - const startTime = Date.now(); - - try { - const result = validateOrder(order); - const endTime = Date.now(); - console.log(`Order processed successfully in ${endTime - startTime}ms`); - console.log(`Processing result: ${JSON.stringify(result)}`); - return result; - } catch (error) { - const endTime = Date.now(); - console.error(`Order processing failed after ${endTime - startTime}ms`); - console.error(`Error details: ${error.message}`); - throw error; - } + // TODO: Add input validation for the order object + const result = validateOrder(order); + return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.12.txt deleted file mode 100644 index ae92865de1b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.12.txt +++ /dev/null @@ -1,7 +0,0 @@ -function processOrder(order) { - console.log(`Processing order: ${JSON.stringify(order)}`); - // TODO: Add comprehensive logging for order processing<<>> - const result = validateOrder(order); - console.log(`Order validation result: ${JSON.stringify(result)}`); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.13.txt deleted file mode 100644 index 7f35f99a518..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.13.txt +++ /dev/null @@ -1,7 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing - console.log(`Processing order: ${JSON.stringify(order)}`); - logger.info(`Order validation started for order ID: ${order.id}`); - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.15.txt deleted file mode 100644 index 0f061bb2cac..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.15.txt +++ /dev/null @@ -1,19 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing - - console.log(`Processing order: ${JSON.stringify(order)}`); - const startTime = Date.now(); - - try { - const result = validateOrder(order); - const endTime = Date.now(); - console.log(`Order processed successfully in ${endTime - startTime}ms`); - return result; - } catch (error) { - const endTime = Date.now(); - console.error(`Order processing failed after ${endTime - startTime}ms: ${error.message}`); - throw error; - } - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.16.txt deleted file mode 100644 index fee85b68bd5..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.16.txt +++ /dev/null @@ -1,8 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing - console.log(`Processing order: ${JSON.stringify(order)}`); - console.time('OrderProcessing'); - - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.18.txt deleted file mode 100644 index f67afdbe131..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.18.txt +++ /dev/null @@ -1,7 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing - console.log(`Processing order: ${JSON.stringify(order)}`); - console.time('orderProcessing'); - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.2.txt deleted file mode 100644 index c9a9169eca4..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.2.txt +++ /dev/null @@ -1,8 +0,0 @@ -function processOrder(order) { - console.log(`Processing order: ${JSON.stringify(order)}`); - console.log(`Order validation started at: ${new Date().toISOString()}`); - const result = validateOrder(order); - console.log(`Order validation completed at: ${new Date().toISOString()}`); - console.log(`Order processing result: ${JSON.stringify(result)}`); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.3.txt similarity index 86% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.14.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.3.txt index 65d5a8f6304..89f439e4735 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.14.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.3.txt @@ -1,7 +1,7 @@ function processOrder(order) { // TODO: Add comprehensive logging for order processing console.log(`Processing order: ${JSON.stringify(order)}`); - const startTime = Date.now(); + const result = validateOrder(order); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.4.txt index 71fa3186894..755c1771d31 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.4.txt @@ -1,6 +1,8 @@ function processOrder(order) { - console.log(`Processing order: ${JSON.stringify(order)}`); - // TODO: Add comprehensive logging for order processing<<>> + // TODO: Add comprehensive logging for order processing + console.log(`Processing order: ${order.id}`); + console.log(`Order details: ${JSON.stringify(order)}`); + const result = validateOrder(order); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.5.txt new file mode 100644 index 00000000000..795bdbba1f5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.5.txt @@ -0,0 +1,10 @@ +function processOrder(order) { + // TODO: Add comprehensive logging for order processing + console.log(`Processing order: ${order.id}`); + console.log(`Customer: ${order.customer.name}`); + console.log(`Items: ${order.items.map(item => item.name).join(', ')}`); + console.log(`Total: $${order.total}`); + + const result = validateOrder(order); + return result; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.6.txt index e5a2fb6aedd..4da70d27510 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.6.txt @@ -1,7 +1,7 @@ function processOrder(order) { - console.log(`Processing order: ${order.id}`); - console.log(`Order details:`, order); - // TODO: Add comprehensive logging for order processing<<>> + // TODO: Add comprehensive logging for order processing + console.log(`Processing order: ${JSON.stringify(order)}`); + // TODO: Add comprehensive validation for order data const result = validateOrder(order); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.7.txt similarity index 85% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.17.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.7.txt index 71680613382..32fd160bd24 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.17.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.7.txt @@ -1,8 +1,8 @@ function processOrder(order) { // TODO: Add comprehensive logging for order processing console.log(`Processing order: ${JSON.stringify(order)}`); - console.time('orderProcessing'); + // Validate the order const result = validateOrder(order); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.8.txt similarity index 76% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.5.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.8.txt index 3456684dc04..bd19a0b9fbb 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.5.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.8.txt @@ -1,6 +1,7 @@ function processOrder(order) { // TODO: Add comprehensive logging for order processing - console.log('Processing order:', order); + console.log("Processing order:", order); + const result = validateOrder(order); return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.9.txt index ee7c01da8a1..b345ee437f0 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.approved.9.txt @@ -1,11 +1,6 @@ function processOrder(order) { + // TODO: Add comprehensive logging for order processing console.log(`Processing order: ${JSON.stringify(order)}`); - try { - const result = validateOrder(order); - console.log(`Order processed successfully: ${JSON.stringify(result)}`); - return result; - } catch (error) { - console.error(`Error processing order: ${error.message}`); - throw error; - } + const result = validateOrder(order); + return result; } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.2.txt new file mode 100644 index 00000000000..bfefa6d224c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.2.txt @@ -0,0 +1,38 @@ +function processOrder(order) { + // TODO: Add comprehensive logging for order processing + console.log(`Processing order: ${JSON.stringify(order)}`); + // TODO: Add validation for order data + if (!order || !order.items || order.items.length === 0) { + console.error('Invalid order data'); + return { success: false, message: 'Invalid order data' }; + } + // TODO: Add error handling for order processing + try { + // Simulate order processing + const total = order.items.reduce((sum, item) => sum + item.price, 0); + console.log(`Order processed successfully. Total: $${total}`); + return { success: true, total }; + } catch (error) { + console.error(`Error processing order: ${error.message}`); + return { success: false, message: error.message }; + } +} + +// Example usage +const order = { + id: 123, + items: [ + { name: 'Product A', price: 10 }, + { name: 'Product B', price: 20 } + ] +}; + +const result = processOrder(order); +console.log(result); + +function validateOrder(order) { + // TODO: Add validation for order data + if (!order || !order.items || order.items.length === + const result = validateOrder(order); + return result; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.3.txt deleted file mode 100644 index f6c3be016de..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.3.txt +++ /dev/null @@ -1,5 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing<<>> - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.7.txt deleted file mode 100644 index 90dab60444a..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.7.txt +++ /dev/null @@ -1,7 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing``` - console.log(`Processing order: ${JSON.stringify(order)}`); -``` - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.8.txt deleted file mode 100644 index 144daed67ed..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-logging.rejected.8.txt +++ /dev/null @@ -1,8 +0,0 @@ -function processOrder(order) { - // TODO: Add comprehensive logging for order processing``` - console.log(`Processing order: ${JSON.stringify(order)}`); - const startTime = Date.now(); -``` - const result = validateOrder(order); - return result; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.1.txt deleted file mode 100644 index 6dec69f3daf..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.1.txt +++ /dev/null @@ -1,4 +0,0 @@ -function fetchUsers(page: number, limit: number) { - const offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.3.txt deleted file mode 100644 index 20bcc8ed711..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.3.txt +++ /dev/null @@ -1,5 +0,0 @@ -function fetchUsers(page, limit) { - const offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); - return db.query('SELECT * FROM users'); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.5.txt deleted file mode 100644 index 07efabc94da..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.5.txt +++ /dev/null @@ -1,7 +0,0 @@ -function fetchUsers(page: number, limit: number) { - // Calculate offset based on page and limit - const offset = (page - 1) * limit; - - // Implement pagination with offset and limit - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.7.txt deleted file mode 100644 index 1e610552cce..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.7.txt +++ /dev/null @@ -1,4 +0,0 @@ -function fetchUsers(page, limit) { - const offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.8.txt deleted file mode 100644 index 35606c59adc..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.8.txt +++ /dev/null @@ -1,4 +0,0 @@ -function fetchUsers(page, limit) { - // TODO: Implement pagination with offset and limit - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, (page - 1) * limit]); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.9.txt deleted file mode 100644 index 6c32c81eb77..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.approved.9.txt +++ /dev/null @@ -1,7 +0,0 @@ -function fetchUsers(page, limit) { - // TODO: Implement pagination with offset and limit - const offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); - - return db.query('SELECT * FROM users'); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.2.txt deleted file mode 100644 index 865922ea955..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.2.txt +++ /dev/null @@ -1,6 +0,0 @@ -function fetchUsers(page, limit) { - // TODO: Implement pagination with offset and limit - const offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); - return db.query('SELECT * FROM users'); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.4.txt deleted file mode 100644 index f815f6a0f7a..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.4.txt +++ /dev/null @@ -1,7 +0,0 @@ -function fetchUsers(page, limit) { - // TODO: Implement pagination with offset and limit``` - const offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); -``` - return db.query('SELECT * FROM users'); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.6.txt deleted file mode 100644 index 9d65117cf70..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-pagination.rejected.6.txt +++ /dev/null @@ -1,5 +0,0 @@ -function fetchUsers(page, limit) { - // TODO: Implement pagination with offset and limitconst offset = (page - 1) * limit; - return db.query('SELECT * FROM users LIMIT ? OFFSET ?', [limit, offset]); - return db.query('SELECT * FROM users'); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.1.txt deleted file mode 100644 index 475b0ce2de4..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.1.txt +++ /dev/null @@ -1,9 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - // Implement rate limiting to prevent abuse - const rateLimit = checkRateLimit(req.ip); - if (!rateLimit.allowed) { - return res.status(429).json({ error: 'Too many requests' }); - } - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.10.txt deleted file mode 100644 index 454ee4ffdaa..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.10.txt +++ /dev/null @@ -1,12 +0,0 @@ -function handleAPIRequest(req, res) { - // Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - limiter(req, res, () => { - processRequest(req, res); - });<<>> - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.11.txt deleted file mode 100644 index d7b07e9b8c8..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.11.txt +++ /dev/null @@ -1,24 +0,0 @@ -function handleAPIRequest(req, res) { - // Rate limiting configuration - const MAX_REQUESTS = 100; // Maximum number of requests allowed - const TIME_WINDOW = 60 * 1000; // Time window in milliseconds (1 minute) - - // Rate limiting implementation - const now = Date.now(); - const windowStart = now - TIME_WINDOW; - - // Filter requests within the current time window - const requestsInWindow = requestTimestamps.filter(timestamp => timestamp > windowStart); - - if (requestsInWindow.length >= MAX_REQUESTS) { - // Too many requests, return 429 Too Many Requests - res.status(429).send('Too many requests, please try again later.'); - return; - } - - // Add current request timestamp - requestTimestamps.push(now); - - // Process the request if rate limit is not exceeded - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.12.txt deleted file mode 100644 index ad801a8c59b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.12.txt +++ /dev/null @@ -1,17 +0,0 @@ -function handleAPIRequest(req, res) { - // Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - limiter(req, res, (err) => { - if (err) { - return res.status(429).json({ error: 'Too many requests, please try again later' }); - } - processRequest(req, res); - }); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.13.txt deleted file mode 100644 index cc779c40144..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.13.txt +++ /dev/null @@ -1,24 +0,0 @@ -function handleAPIRequest(req, res) { - // Implement rate limiting to prevent abuse - const rateLimit = 100; // requests per minute - const windowMs = 60 * 1000; // 1 minute in milliseconds - const now = Date.now(); - const windowStart = now - windowMs; - - // Initialize or get the request count for this IP - let requestCount = req.ipRequestCounts.get(req.ip) || 0; - - // Filter out requests that are outside the current window - req.ipRequestCounts.set(req.ip, requestCount.filter(timestamp => timestamp > windowStart).length); - - // Check if the request count exceeds the rate limit - if (requestCount >= rateLimit) { - res.status(429).send('Too many requests, please try again later.'); - return; - } - - // Add the current request timestamp - req.ipRequestCounts.set(req.ip, [...req.ipRequestCounts.get(req.ip), now]); - - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.14.txt deleted file mode 100644 index 45c43a46fbc..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.14.txt +++ /dev/null @@ -1,14 +0,0 @@ -function handleAPIRequest(req, res) { - // Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100, // limit each IP to 100 requests per windowMs - message: 'Too many requests from this IP, please try again later' - }); - - limiter(req, res, () => { - processRequest(req, res); - }); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.15.txt deleted file mode 100644 index 6f32f28ec7e..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.15.txt +++ /dev/null @@ -1,13 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - limiter(req, res, () => { - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.16.txt deleted file mode 100644 index 392fa49d8ec..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.16.txt +++ /dev/null @@ -1,15 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to API calls - limiter(req, res, () => { - processRequest(req, res); - }); - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.17.txt deleted file mode 100644 index 24d27247127..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.17.txt +++ /dev/null @@ -1,15 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - limiter(req, res, () => { - processRequest(req, res); - }); - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.18.txt deleted file mode 100644 index bf3d0d22592..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.18.txt +++ /dev/null @@ -1,8 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - // Implement rate limiting logic here - // For example, using a library like 'express-rate-limit' - // or a custom solution with Redis or an in-memory store - - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.19.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.19.txt deleted file mode 100644 index f3ba3d40dc6..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.19.txt +++ /dev/null @@ -1,8 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - // Check if the user has exceeded the rate limit - if (isRateLimited(req)) { - return res.status(429).send('Too many requests'); - } - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.20.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.20.txt deleted file mode 100644 index b1c5bc03dec..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.20.txt +++ /dev/null @@ -1,14 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - // Check if the user has exceeded the rate limit - const rateLimit = getRateLimit(req.ip); - if (rateLimit > MAX_REQUESTS_PER_MINUTE) { - res.status(429).send('Too many requests'); - return; - } - - // Increment the rate limit counter - incrementRateLimit(req.ip); - - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.21.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.21.txt deleted file mode 100644 index d598ab4672f..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.21.txt +++ /dev/null @@ -1,9 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - - // Check if the user has exceeded the rate limit - if (rateLimiter.isExceeded(req.ip)) { - return res.status(429).json({ error: 'Too many requests' }); - } - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.3.txt deleted file mode 100644 index 3af0ed5be53..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.3.txt +++ /dev/null @@ -1,19 +0,0 @@ -function handleAPIRequest(req, res) { - // Rate limiting implementation - const rateLimit = require('express-rate-limit'); - - // Create a rate limiter middleware - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100, // limit each IP to 100 requests per windowMs - message: 'Too many requests from this IP, please try again later' - }); - - // Apply the rate limiter to the API request - limiter(req, res, (err) => { - if (err) { - return res.status(429).json({ error: err.message }); - } - processRequest(req, res); - }); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.5.txt deleted file mode 100644 index f2cb6e08714..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.5.txt +++ /dev/null @@ -1,13 +0,0 @@ -function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - app.use(limiter); - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.7.txt deleted file mode 100644 index 52c0c21e3cf..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.7.txt +++ /dev/null @@ -1,13 +0,0 @@ -function handleAPIRequest(req, res) { - // Implement rate limiting to prevent abuse - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - app.use(limiter);<<>> - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.9.txt deleted file mode 100644 index 603a4948ce5..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.approved.9.txt +++ /dev/null @@ -1,28 +0,0 @@ -function handleAPIRequest(req, res) { - // Implement rate limiting to prevent abuse - const rateLimit = 100; // requests per minute - const windowMs = 60 * 1000; // 1 minute in milliseconds - const now = Date.now(); - const windowStart = now - windowMs; - - // Initialize request count if it doesn't exist - if (!req.app.locals.requestCounts) { - req.app.locals.requestCounts = []; - } - - // Remove old requests from the window - req.app.locals.requestCounts = req.app.locals.requestCounts.filter( - timestamp => timestamp > windowStart - ); - - // Check if the request limit has been exceeded - if (req.app.locals.requestCounts.length >= rateLimit) { - res.status(429).send('Too many requests, please try again later.'); - return; - } - - // Add the current request to the count - req.app.locals.requestCounts.push(now); - - processRequest(req, res); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.1.txt new file mode 100644 index 00000000000..142eda244d9 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.1.txt @@ -0,0 +1,15 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.10.txt new file mode 100644 index 00000000000..25b1101572c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.10.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement request/response logging + // TODO: Implement request/response validation + // TODO: Implement request/response transformation + // TODO: Implement request/response routing + // TODO: Implement request/response filtering + // TODO: Implement request/response aggregation + // TODO: Implement request/response batching + // TODO: Implement request/response streaming + // TODO: Implement request/response pagination + // TODO: Implement request/response sorting + // TODO: Implement request/response filtering + // TODO: Implement request/response searching + // TODO: Implement request/response counting + // TODO: Implement request/response statistics + // TODO: Implement request/response analytics + // TODO: Implement request/response monitoring + // TODO: Implement request/response alerting + // TODO: Implement request/response troubleshooting + // TODO: Implement request/response debugging + // TODO + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.11.txt new file mode 100644 index 00000000000..78835ed2196 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.11.txt @@ -0,0 +1,4 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse of the API + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.12.txt new file mode 100644 index 00000000000..393413016c8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.12.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API scalability and performance optimization + // TODO: Implement API deployment and CI/CD pipeline + // TODO: Implement API testing and quality assurance + // TODO: Implement API monitoring and alerting + // TODO: Implement API governance and compliance + // TODO: Implement API monetization and pricing + // TODO: Implement API analytics and reporting + // TODO: Implement API feedback and improvement + // TODO: Implement API community and support + // TODO: Implement API roadmap and planning + // TODO: Implement API innovation and experimentation + // TODO: Implement API strategy and vision + // TODO: Implement API culture and values + // TODO: Implement API leadership and management + // TODO: Implement API team and collaboration + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.13.txt new file mode 100644 index 00000000000..7a1676da39a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.13.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement request/response encryption + // TODO: Implement request/response validation + // TODO: Implement request/response transformation + // TODO: Implement request/response logging + // TODO: Implement request/response monitoring + // TODO: Implement request/response analytics + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response scalability + // TODO: Implement request/response reliability + // TODO: Implement request/response maintainability + // TODO: Implement request/response extensibility + // TODO: Implement request/response documentation + // TODO: Implement request/response testing + // TODO: Implement request/response deployment + // TODO: Implement request/response monitoring + // TODO: Implement request/response troubleshooting + // TODO: Implement request/response debugging + // TODO: Implement request/response profiling + // TODO: Implement request/response optimization + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.14.txt new file mode 100644 index 00000000000..8b993fd3249 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.14.txt @@ -0,0 +1,28 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement request/response headers + // TODO: Implement request/response body parsing + // TODO: Implement request/response body validation + // TODO: Implement request/response body sanitization + // TODO: Implement request/response body compression + // TODO: Implement request/response body encryption + // TODO: Implement request/response body signing + // TODO: Implement request/response body verification + // TODO: Implement request/response body logging + // TODO: Implement request/response body caching + // TODO: Implement request/response body streaming + // TODO: Implement request/response body chunking + // TODO: Implement request/response body buffering + // TODO: Implement request/response body throttling + // TODO: Implement request/response body prioritization + // TODO: Implement request/response body retrying + // TODO: Implement request/response body timeouts + // TODO: + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.15.txt new file mode 100644 index 00000000000..41df30eb232 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.15.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response retry + // TODO: Implement API request/response timeout + // TODO: Implement API request/response circuit breaker + // TODO: Implement API request/response load balancing + // TODO: Implement API request/response service discovery + // TODO: Implement API request/response health checks + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.16.txt new file mode 100644 index 00000000000..2c3adc9b929 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.16.txt @@ -0,0 +1,28 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response retry + // TODO: Implement API request/response timeout + // TODO: Implement API request/response retry with exponential backoff + // TODO: Implement API request/response retry with jitter + // TODO: Implement API request/response retry with circuit breaker + // TODO: Implement + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.17.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.17.txt new file mode 100644 index 00000000000..b2ab02f6e75 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.17.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement request validation + // TODO: Implement error handling + // TODO: Implement logging + // TODO: Implement caching + // TODO: Implement request/response transformation + // TODO: Implement request/response compression + // TODO: Implement request/response encryption + // TODO: Implement request/response signing + // TODO: Implement request/response validation + // TODO: Implement request/response logging + // TODO: Implement request/response monitoring + // TODO: Implement request/response analytics + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response reliability + // TODO: Implement request/response scalability + // TODO: Implement request/response performance + // TODO: Implement request/response maintainability + // TODO: Implement request/response testability + // TODO: Implement request/response documentation + // TODO: Implement request/response versioning + // TODO: Implement request/response deprecation + // TODO: Implement request/response migration + // TODO: Implement request/response compatibility + // TODO: Implement request/response interoper + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.18.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.18.txt new file mode 100644 index 00000000000..abdcace7b65 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.18.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response validation + // TODO: Implement API request/response logging + // TODO: Implement API request/response monitoring + // TODO: Implement API request/response analytics + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response validation + // TODO: Implement API request/response logging + // TODO: Implement API request/response monitoring + // TODO: Implement API request/response analytics + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.19.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.19.txt new file mode 100644 index 00000000000..65f4d15080f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.19.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement logging and monitoring + // TODO: Implement caching for better performance + // TODO: Implement error handling and recovery + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API testing and quality assurance + // TODO: Implement API deployment and monitoring + // TODO: Implement API scaling and load balancing + // TODO: Implement API security and compliance + // TODO: Implement API analytics and reporting + // TODO: Implement API monetization and billing + // TODO: Implement API integrations and partnerships + // TODO: Implement API community and support + // TODO: Implement API roadmap and future development + // TODO: Implement API governance and policies + // TODO: Implement API lifecycle management + // TODO: Implement API best practices and guidelines + // TODO: Implement API design principles and patterns + // TODO: Implement API architecture and infrastructure + // TODO: Implement API performance optimization + // TODO: Implement API reliability and availability + // TODO: + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.2.txt index 3186658ec26..24b5683bbb4 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.2.txt @@ -1,5 +1,29 @@ function handleAPIRequest(req, res) { // TODO: Implement rate limiting to prevent abuse - // Add rate limiting logic here + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement request/response encryption + // TODO: Implement request/response validation + // TODO: Implement request/response logging + // TODO: Implement request/response monitoring + // TODO: Implement request/response tracing + // TODO: Implement request/response auditing + // TODO: Implement request/response analytics + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response scalability + // TODO: Implement request/response reliability + // TODO: Implement request/response availability + // TODO: Implement request/response performance + // TODO: Implement request/response maintainability + // TODO: Implement request/response extensibility + // TODO: Implement request/response flexibility + // TODO: Implement request/response interoperability + // TODO: Implement request/response compatibility + // TODO: Implement request/response portability + // TODO: Implement request/response processRequest(req, res); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.20.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.20.txt new file mode 100644 index 00000000000..f05bf8d95c0 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.20.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement request/response encryption + // TODO: Implement request/response validation + // TODO: Implement request/response logging + // TODO: Implement request/response monitoring + // TODO: Implement request/response analytics + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response scalability + // TODO: Implement request/response reliability + // TODO: Implement request/response maintainability + // TODO: Implement request/response extensibility + // TODO: Implement request/response documentation + // TODO: Implement request/response testing + // TODO: Implement request/response deployment + // TODO: Implement request/response monitoring + // TODO: Implement request/response analytics + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response scalability + // TODO: Implement request/response reliability + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.21.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.21.txt new file mode 100644 index 00000000000..0f8dce12930 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.21.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response verification + // TODO: Implement API request/response retry + // TODO: Implement API request/response timeout + // TODO: Implement API request/response circuit breaker + // TODO: Implement API request/response load balancing + // TODO: Implement API request/response service discovery + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.22.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.22.txt new file mode 100644 index 00000000000..e526d8eb2b4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.22.txt @@ -0,0 +1,32 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security headers + // TODO: Implement API rate limiting + // TODO: Implement API request throttling + // TODO: Implement API request validation + // TODO: Implement API request sanitization + // TODO: Implement API request logging + // TODO: Implement API response logging + // TODO: Implement API response caching + // TODO: Implement API response compression + // TODO: Implement API response headers + // TODO: Implement API response validation + // TODO: Implement API response sanitization + // TODO: Implement API response logging + // TODO: Implement API response compression + // TODO: Implement API response headers + // TODO: Implement API response validation + // TODO: Implement API response sanitization + // TODO: Implement API response logging + // TODO + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.23.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.23.txt new file mode 100644 index 00000000000..06ab19789eb --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.23.txt @@ -0,0 +1,28 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for frequently accessed data + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices (e.g., HTTPS, secure headers) + // TODO: Implement API throttling and circuit breaking + // TODO: Implement API response formatting (e.g., JSON, XML) + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response retry + // TODO: Implement API request/response timeout + // TODO: Implement API request/response batching + // TODO: Implement API request/response streaming + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.24.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.24.txt new file mode 100644 index 00000000000..534ecc2faa0 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.24.txt @@ -0,0 +1,31 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement request validation + // TODO: Implement error handling + // TODO: Implement logging + // TODO: Implement caching + // TODO: Implement request/response transformation + // TODO: Implement request/response compression + // TODO: Implement request/response encryption + // TODO: Implement request/response signing + // TODO: Implement request/response validation + // TODO: Implement request/response logging + // TODO: Implement request/response monitoring + // TODO: Implement request/response tracing + // TODO: Implement request/response correlation + // TODO: Implement request/response auditing + // TODO: Implement request/response compliance + // TODO: Implement request/response governance + // TODO: Implement request/response security + // TODO: Implement request/response privacy + // TODO: Implement request/response integrity + // TODO: Implement request/response availability + // TODO: Implement request/response reliability + // TODO: Implement request/response scalability + // TODO: Implement request/response performance + // TODO: Implement request/response efficiency + // TODO: Implement request/response maintainability + // TODO + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.25.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.25.txt new file mode 100644 index 00000000000..9f8c1a651eb --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.25.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API scalability and performance optimization + // TODO: Implement API deployment and CI/CD pipeline + // TODO: Implement API testing and quality assurance + // TODO: Implement API maintenance and support + // TODO: Implement API deprecation and sunset policy + // TODO: Implement API governance and compliance + // TODO: Implement API monetization and business model + // TODO: Implement API community and developer relations + // TODO: Implement API success stories and case studies + // TODO: Implement API best practices and guidelines + // TODO: Implement API design patterns and principles + // TODO: Implement API architecture and patterns + // TODO: Implement API integration and interoperability + // TODO: Implement API standards and protocols + // + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.26.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.26.txt new file mode 100644 index 00000000000..a9d09ec0343 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.26.txt @@ -0,0 +1,28 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for frequently accessed data + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices (e.g., HTTPS, HSTS, CSP) + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response monitoring + // TODO: Implement API request/response analytics + // TODO: Implement API request/response tracing + // TODO: Implement API request/response debugging + // TODO: Implement API request/response testing + // TODO + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.27.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.27.txt new file mode 100644 index 00000000000..7efd7284810 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.27.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching to improve performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response monitoring + // TODO: Implement API request/response analytics + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.28.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.28.txt new file mode 100644 index 00000000000..906a832911f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.28.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement request/response logging + // TODO: Implement request/response monitoring + // TODO: Implement request/response tracing + // TODO: Implement request/response metrics + // TODO: Implement request/response analytics + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response scalability + // TODO: Implement request/response reliability + // TODO: Implement request/response availability + // TODO: Implement request/response performance + // TODO: Implement request/response usability + // TODO: Implement request/response maintainability + // TODO: Implement request/response testability + // TODO: Implement request/response deployability + // TODO: Implement request/response configurability + // TODO: Implement request/response extensibility + // TODO: Implement request/response compatibility + // TODO: Implement request/response interoperability + // TODO: Implement request/ + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.3.txt new file mode 100644 index 00000000000..91565afd4cc --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.3.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API scalability and performance optimization + // TODO: Implement API deployment and CI/CD pipeline + // TODO: Implement API testing and quality assurance + // TODO: Implement API monitoring and alerting + // TODO: Implement API backup and disaster recovery + // TODO: Implement API compliance and governance + // TODO: Implement API cost management and optimization + // TODO: Implement API integration with other systems + // TODO: Implement API extensibility and customization + // TODO: Implement API governance and lifecycle management + // TODO: Implement API security and compliance audits + // TODO: Implement API performance tuning and optimization + // TODO: Implement API scalability and capacity planning + // TODO: Implement API monitoring and troubleshooting + + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.4.txt index 2513abcd9a6..d45e7551d6a 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.4.txt @@ -1,19 +1,28 @@ function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse``` - // Rate limiting implementation - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - limiter(req, res, (err) => { - if (err) { - return res.status(429).json({ error: 'Too many requests, please try again later.' }); - } - }); -``` + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API scalability and performance optimization + // TODO: Implement API deployment and CI/CD pipeline + // TODO: Implement API monitoring and alerting + // TODO: Implement API security testing and penetration testing + // TODO: Implement API compliance with relevant regulations and standards + // TODO: Implement API governance and management + // TODO: Implement API monetization and business model + // TODO: Implement API community and developer engagement + // TODO: Implement API roadmap and future development + // TODO: Implement API support and customer success + // TODO: Implement API analytics and reporting + // TODO: Implement API security and compliance audits + // TODO: Implement API performance and scalability testing + // TODO: Implement API integration and inter processRequest(req, res); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.5.txt new file mode 100644 index 00000000000..89ca5c6067d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.5.txt @@ -0,0 +1,30 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement request/response logging + // TODO: Implement request/response validation + // TODO: Implement request/response transformation + // TODO: Implement request/response filtering + // TODO: Implement request/response pagination + // TODO: Implement request/response sorting + // TODO: Implement request/response filtering + // TODO: Implement request/response aggregation + // TODO: Implement request/response transformation + // TODO: Implement request/response validation + // TODO: Implement request/response logging + // TODO: Implement request/response caching + // TODO: Implement request/response compression + // TODO: Implement request/response encryption + // TODO: Implement request/response decryption + // TODO: Implement request/response signing + // TODO: Implement request/response verification + // TODO: Implement request/response retry + // TODO: Implement request/response timeout + // TODO: Implement + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.6.txt index 4f47fa1ecb1..4e5023d61b7 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.6.txt @@ -1,17 +1,28 @@ function handleAPIRequest(req, res) { - // TODO: Implement rate limiting to prevent abuse``` - const rateLimit = require('express-rate-limit'); - - const limiter = rateLimit({ - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100 // limit each IP to 100 requests per windowMs - }); - - // Apply the rate limiting middleware to all requests - limiter(req, res, () => { - // If the rate limit is exceeded, the callback will not be called - // So we can safely proceed with processing the request - }); -``` + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API throttling + // TODO: Implement API security headers + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response retry + // TODO: Implement API request/response timeout + // TODO: Implement API request/response retry with exponential backoff + // TODO: Implement API request/response retry with jitter + // TODO: Implement API request/response retry with circuit breaker + // TODO: Implement API request/response processRequest(req, res); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.7.txt new file mode 100644 index 00000000000..296ba482534 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.7.txt @@ -0,0 +1,27 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement logging and monitoring + // TODO: Implement error handling and recovery + // TODO: Implement caching for better performance + // TODO: Implement pagination for large datasets + // TODO: Implement compression for faster data transfer + // TODO: Implement security headers for better security + // TODO: Implement CORS for cross-origin requests + // TODO: Implement CSRF protection for form submissions + // TODO: Implement XSS protection for user-generated content + // TODO: Implement SQL injection protection for database queries + // TODO: Implement file upload and download functionality + // TODO: Implement real-time updates using WebSockets or Server-Sent Events + // TODO: Implement background job processing using a queue system + // TODO: Implement internationalization and localization + // TODO: Implement dark mode and other accessibility features + // TODO: Implement analytics and tracking + // TODO: Implement user feedback and bug reporting + // TODO: Implement versioning for API endpoints + // TODO: Implement deprecation warnings for old API versions + // TODO: Implement API documentation and examples + // TODO: Implement API + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.8.txt index ee2e9983130..1672a398675 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.8.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.8.txt @@ -1,27 +1,30 @@ function handleAPIRequest(req, res) { // TODO: Implement rate limiting to prevent abuse // TODO: Implement authentication and authorization - // TODO: Implement request validation - // TODO: Implement error handling - // TODO: Implement logging - // TODO: Implement caching + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance // TODO: Implement request/response compression // TODO: Implement CORS support - // TODO: Implement request/response headers - // TODO: Implement request/response body parsing - // TODO: Implement request/response body validation - // TODO: Implement request/response body sanitization - // TODO: Implement request/response body transformation - // TODO: Implement request/response body encryption/decryption - // TODO: Implement request/response body compression/decompression - // TODO: Implement request/response body serialization/deserialization - // TODO: Implement request/response body validation - // TODO: Implement request/response body sanitization - // TODO: Implement request/response body transformation - // TODO: Implement request/response body encryption/decryption - // TODO: Implement request/response body compression/decompression - // TODO: Implement request/response body serialization/deserialization - // TODO: Implement request/response body validation - // TODO: Implement request/response body sanitization + // TODO: Implement request/response logging + // TODO: Implement request/response validation + // TODO: Implement request/response transformation + // TODO: Implement request/response routing + // TODO: Implement request/response filtering + // TODO: Implement request/response pagination + // TODO: Implement request/response sorting + // TODO: Implement request/response searching + // TODO: Implement request/response aggregation + // TODO: Implement request/response analytics + // TODO: Implement request/response monitoring + // TODO: Implement request/response optimization + // TODO: Implement request/response security + // TODO: Implement request/response scalability + // TODO: Implement request/response reliability + // TODO: Implement request/response maintainability + // TODO: Implement request/response extensibility + // TODO: Implement request/response documentation + // TODO: Implement request/response testing + // TODO processRequest(req, res); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.9.txt new file mode 100644 index 00000000000..cb1b9e2f077 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-rate-limiting.rejected.9.txt @@ -0,0 +1,29 @@ +function handleAPIRequest(req, res) { + // TODO: Implement rate limiting to prevent abuse + // TODO: Implement authentication and authorization + // TODO: Implement input validation and sanitization + // TODO: Implement error handling and logging + // TODO: Implement caching for better performance + // TODO: Implement request/response compression + // TODO: Implement CORS support + // TODO: Implement API versioning + // TODO: Implement API documentation + // TODO: Implement API monitoring and analytics + // TODO: Implement API security best practices + // TODO: Implement API rate limiting and throttling + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: Implement API request/response caching + // TODO: Implement API request/response compression + // TODO: Implement API request/response encryption + // TODO: Implement API request/response signing + // TODO: Implement API request/response monitoring + // TODO: Implement API request/response analytics + // TODO: Implement API request/response tracing + // TODO: Implement API request/response logging + // TODO: Implement API request/response validation + // TODO: Implement API request/response transformation + // TODO: + processRequest(req, res); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.1.txt deleted file mode 100644 index 8728deb8d60..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.1.txt +++ /dev/null @@ -1,21 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (attempt === maxRetries - 1) { - throw error; - } - - const delay = baseDelay * Math.pow(2, attempt); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.10.txt deleted file mode 100644 index b048deaf5c7..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.10.txt +++ /dev/null @@ -1,21 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - - const delay = baseDelay * Math.pow(2, attempt); - await new Promise(resolve => setTimeout(resolve, delay)); - } - }<<>> - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.11.txt deleted file mode 100644 index ec2ca760686..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.11.txt +++ /dev/null @@ -1,20 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - for (let attempt = 1; attempt <= maxRetries; attempt++) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (attempt === maxRetries) { - throw error; - } - const delay = baseDelay * Math.pow(2, attempt - 1); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.12.txt deleted file mode 100644 index 52a3d37e6db..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.12.txt +++ /dev/null @@ -1,25 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff - let retries = 0; - const maxRetries = 3; - let delay = 1000; // Initial delay in milliseconds - - while (retries < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - retries++; - if (retries === maxRetries) { - throw error; - } - await new Promise(resolve => setTimeout(resolve, delay)); - delay *= 2; // Exponential backoff - } - } - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.13.txt deleted file mode 100644 index 7a59cfa16a5..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.13.txt +++ /dev/null @@ -1,25 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff - let retryCount = 0; - const maxRetries = 3; - const initialDelay = 1000; - - while (retryCount < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (retryCount === maxRetries - 1) { - throw error; - } - const delay = initialDelay * Math.pow(2, retryCount); - await new Promise(resolve => setTimeout(resolve, delay)); - retryCount++; - } - } - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.14.txt deleted file mode 100644 index cd873520d8b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.14.txt +++ /dev/null @@ -1,26 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff - let retries = 0; - const maxRetries = 3; - const baseDelay = 1000; - - while (retries < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - retries++; - if (retries === maxRetries) { - throw error; - } - const delay = baseDelay * Math.pow(2, retries - 1); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } - - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.15.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.15.txt deleted file mode 100644 index fb57e9619c5..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.15.txt +++ /dev/null @@ -1,27 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff - let retryCount = 0; - const maxRetries = 3; - const initialDelay = 1000; - - while (retryCount < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - console.error(`Attempt ${retryCount + 1} failed: ${error.message}`); - retryCount++; - if (retryCount < maxRetries) { - const delay = initialDelay * Math.pow(2, retryCount); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } - } - throw new Error(`Failed to fetch after ${maxRetries} attempts`); - - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.16.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.16.txt deleted file mode 100644 index e9b8d3a3fe1..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.16.txt +++ /dev/null @@ -1,26 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff - let retryCount = 0; - const maxRetries = 3; - const baseDelay = 1000; - - while (retryCount < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - retryCount++; - if (retryCount === maxRetries) { - throw error; - } - const delay = baseDelay * Math.pow(2, retryCount - 1); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } - - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.3.txt deleted file mode 100644 index 26b5f8f6e66..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.3.txt +++ /dev/null @@ -1,20 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - for (let attempt = 1; attempt <= maxRetries; attempt++) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (attempt === maxRetries) throw error; - const delay = baseDelay * Math.pow(2, attempt - 1); - await new Promise(resolve => setTimeout(resolve, delay)); - } - }<<>> - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.5.txt deleted file mode 100644 index 7fa80ee4ca4..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.5.txt +++ /dev/null @@ -1,26 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - let retryCount = 0; - let delay = 1000; // Initial delay in milliseconds - - while (retryCount < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - console.error(`Attempt ${retryCount + 1} failed: ${error.message}`); - retryCount++; - if (retryCount < maxRetries) { - await new Promise(resolve => setTimeout(resolve, delay)); - delay *= 2; // Exponential backoff - } - } - } - throw new Error(`Failed after ${maxRetries} attempts`); -} - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.8.txt deleted file mode 100644 index 311d554c206..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.8.txt +++ /dev/null @@ -1,19 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - for (let attempt = 0; attempt < maxRetries; attempt++) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (attempt === maxRetries - 1) throw error; - - const delay = baseDelay * Math.pow(2, attempt); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.9.txt deleted file mode 100644 index 0307dd148e8..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.approved.9.txt +++ /dev/null @@ -1,21 +0,0 @@ -async function fetchWithRetry(url) { - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - for (let attempt = 1; attempt <= maxRetries; attempt++) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - if (attempt === maxRetries) { - throw error; - } - const delay = baseDelay * Math.pow(2, attempt - 1); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.1.txt similarity index 79% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.4.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.1.txt index 3c55e4ed478..512cfa8434b 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.1.txt @@ -1,5 +1,6 @@ async function fetchWithRetry(url) { // TODO: Implement retry logic with exponential backoff + // Hint: Use setTimeout and recursion const response = await fetch(url); return response.json(); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.2.txt deleted file mode 100644 index aa340baa08b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.2.txt +++ /dev/null @@ -1,9 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff - - const maxRetries = 3; - let retryCount = 0; - let delay = 1000; - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.6.txt deleted file mode 100644 index 1fb90a1fc70..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.6.txt +++ /dev/null @@ -1,26 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff``` - let retryCount = 0; - const maxRetries = 3; - const baseDelay = 1000; // 1 second - - while (retryCount < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - retryCount++; - if (retryCount === maxRetries) { - throw error; - } - const delay = baseDelay * Math.pow(2, retryCount - 1); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } -``` - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.7.txt deleted file mode 100644 index 481246e041d..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-retry-logic.rejected.7.txt +++ /dev/null @@ -1,24 +0,0 @@ -async function fetchWithRetry(url) { - // TODO: Implement retry logic with exponential backoff const maxRetries = 3; - let retryCount = 0; - let delay = 1000; // Initial delay in milliseconds - - while (retryCount < maxRetries) { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - return response.json(); - } catch (error) { - retryCount++; - if (retryCount === maxRetries) { - throw error; - } - await new Promise(resolve => setTimeout(resolve, delay)); - delay *= 2; // Exponential backoff - } - } - const response = await fetch(url); - return response.json(); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.1.txt deleted file mode 100644 index 3a21288ef16..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.1.txt +++ /dev/null @@ -1,6 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks - // Sanitize input to prevent XSS attacks - const sanitizedComment = DOMPurify.sanitize(comment); - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.10.txt deleted file mode 100644 index 83ff14893f5..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.10.txt +++ /dev/null @@ -1,8 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks: - - // Sanitize the comment to prevent XSS attacks - const sanitizedComment = comment.replace(//g, ">"); - document.getElementById('comments').innerHTML = sanitizedComment; - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.11.txt deleted file mode 100644 index af6132b2963..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.11.txt +++ /dev/null @@ -1,7 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks -// Sanitize the comment to prevent XSS attacks - const sanitizedComment = comment.replace(//g, ">"); - document.getElementById('comments').innerHTML = sanitizedComment; - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.3.txt deleted file mode 100644 index 6c30c06725c..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.3.txt +++ /dev/null @@ -1,5 +0,0 @@ -function renderUserComment(comment) { - // Sanitize input to prevent XSS attacks - const sanitizedComment = comment.replace(//g, '>'); - document.getElementById('comments').innerHTML = sanitizedComment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.5.txt deleted file mode 100644 index 1229f4e61c1..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.5.txt +++ /dev/null @@ -1,6 +0,0 @@ -function renderUserComment(comment) { - // Sanitize input to prevent XSS attacks - const sanitizedComment = comment.replace(//g, ">"); - document.getElementById('comments').innerHTML = sanitizedComment; - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.6.txt deleted file mode 100644 index fd509517516..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.6.txt +++ /dev/null @@ -1,7 +0,0 @@ -function renderUserComment(comment) { - // Sanitize input to prevent XSS attacks - const sanitizedComment = comment.replace(//g, '>'); - document.getElementById('comments').innerHTML = sanitizedComment; -} - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.7.txt deleted file mode 100644 index 96ddf5f7426..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.7.txt +++ /dev/null @@ -1,4 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks - document.getElementById('comments').innerHTML = sanitizeHTML(comment); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.8.txt deleted file mode 100644 index 7a9709607f4..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.8.txt +++ /dev/null @@ -1,5 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks - comment = comment.replace(//g, '>'); - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.9.txt deleted file mode 100644 index 7906a8682b3..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.approved.9.txt +++ /dev/null @@ -1,6 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks - const sanitizedComment = comment.replace(//g, ">"); - document.getElementById('comments').innerHTML = sanitizedComment; - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.rejected.2.txt deleted file mode 100644 index ab252c1f653..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.rejected.2.txt +++ /dev/null @@ -1,6 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks``` - comment = comment.replace(//g, '>'); -``` - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.rejected.4.txt deleted file mode 100644 index b66297faa8b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-sanitize-input.rejected.4.txt +++ /dev/null @@ -1,7 +0,0 @@ -function renderUserComment(comment) { - // TODO: Sanitize input to prevent XSS attacks -// TODO: Sanitize input to prevent XSS attacks - const sanitizedComment = comment.replace(//g, '>'); - document.getElementById('comments').innerHTML = sanitizedComment; - document.getElementById('comments').innerHTML = comment; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.1.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.1.txt index 92708ae32ec..aa17796f532 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.1.txt @@ -1,8 +1,7 @@ function registerUser(email, password) { // TODO: Add input validation for email and password - // Add input validation for email and password - if (!email || !password) { - throw new Error('Email and password are required'); - } + // TODO: Add error handling for duplicate email + // TODO: Add password hashing for security + return createUser(email, password); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.10.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.10.txt deleted file mode 100644 index a073a042b7e..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.10.txt +++ /dev/null @@ -1,16 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password - if (!email || !password) { - throw new Error('Email and password are required'); - } - - const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - if (!emailRegex.test(email)) { - throw new Error('Invalid email format'); - } - - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.11.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.11.txt deleted file mode 100644 index 3180bde8769..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.11.txt +++ /dev/null @@ -1,16 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password - - if (!email || !password) { - throw new Error('Email and password are required'); - } - - if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { - throw new Error('Invalid email format'); - } - - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.12.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.12.txt deleted file mode 100644 index fccd31093cc..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.12.txt +++ /dev/null @@ -1,8 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password -// Check if email is valid and password meets requirements - if (!validateEmail(email) || !validatePassword(password)) { - throw new Error('Invalid email or password'); - } - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.13.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.13.txt deleted file mode 100644 index c8722d479bb..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.13.txt +++ /dev/null @@ -1,12 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password -// Check if email is valid and password meets requirements - if (!validateEmail(email)) { - throw new Error('Invalid email address'); - } - - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.14.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.14.txt deleted file mode 100644 index 45705350594..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.14.txt +++ /dev/null @@ -1,13 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password - if (!email || !password) { - throw new Error('Email and password are required'); - } - if (!email.includes('@')) { - throw new Error('Invalid email format'); - } - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.4.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.2.txt similarity index 58% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.4.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.2.txt index cf587a781ef..f59c5d7a440 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.2.txt @@ -1,7 +1,7 @@ function registerUser(email, password) { // TODO: Add input validation for email and password - if (!email || !password) { - throw new Error('Email and password are required'); - } + // TODO: Add error handling for duplicate emails + // TODO: Add password hashing for security + return createUser(email, password); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.3.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.3.txt index a7dc147f876..d35231d6888 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.3.txt @@ -1,23 +1,8 @@ -function registerUser(email: string, password: string) { - // Validate email format - if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { - throw new Error('Invalid email format'); - } - - // Validate password length - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - - // Validate password contains at least one number - if (!/\d/.test(password)) { - throw new Error('Password must contain at least one number'); - } - - // Validate password contains at least one special character - if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) { - throw new Error('Password must contain at least one special character'); - } - +function registerUser(email, password) { + // TODO: Add input validation for email and password + // TODO: Add error handling for duplicate email + // TODO: Add password strength requirements + // TODO: Add email verification + // TODO: Add logging for security purposes return createUser(email, password); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.5.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.4.txt similarity index 58% rename from src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.5.txt rename to src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.4.txt index e7c06ac2747..45fdf1fb76e 100644 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.5.txt +++ b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.4.txt @@ -1,5 +1,7 @@ function registerUser(email, password) { // TODO: Add input validation for email and password -// Check if email is valid and password meets requirements + // TODO: Add error handling for duplicate email + // TODO: Add password strength requirements + return createUser(email, password); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.6.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.6.txt deleted file mode 100644 index 3697934ef3b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.6.txt +++ /dev/null @@ -1,13 +0,0 @@ -function registerUser(email: string, password: string) { - // Validate email format - if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { - throw new Error('Invalid email format'); - } - - // Validate password length - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.7.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.7.txt deleted file mode 100644 index b4390a4cd3c..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.7.txt +++ /dev/null @@ -1,13 +0,0 @@ -function registerUser(email: string, password: string) { - // Validate email - if (!email || typeof email !== 'string' || !email.includes('@')) { - throw new Error('Invalid email address'); - } - - // Validate password - if (!password || typeof password !== 'string' || password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.8.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.8.txt deleted file mode 100644 index bf7485efc70..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.8.txt +++ /dev/null @@ -1,13 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password - if (!email || !password) { - throw new Error('Email and password are required'); - } - if (!email.includes('@')) { - throw new Error('Invalid email format'); - } - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - }<<>> - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.9.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.9.txt deleted file mode 100644 index 3697934ef3b..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.approved.9.txt +++ /dev/null @@ -1,13 +0,0 @@ -function registerUser(email: string, password: string) { - // Validate email format - if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { - throw new Error('Invalid email format'); - } - - // Validate password length - if (password.length < 8) { - throw new Error('Password must be at least 8 characters long'); - } - - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.2.txt b/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.2.txt deleted file mode 100644 index 8fba30ba50c..00000000000 --- a/src/test-llm-autocompletion/approvals/comment-driven/todo-validation.rejected.2.txt +++ /dev/null @@ -1,4 +0,0 @@ -function registerUser(email, password) { - // TODO: Add input validation for email and password<<>> - return createUser(email, password); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.1.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.1.txt index fcca2150ca0..d13783a707f 100644 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.1.txt @@ -1,3 +1,13 @@ const result = [1, 2, 3] .map(x => x * 2) - .filter(x => x > 2) \ No newline at end of file + .filter(x => x > 2) + .reduce((acc, x) => acc + x, 0); + +console.log(result); + +const result2 = [1, 2, 3] + .map(x => x * 2) + .filter(x => x > 2) + .reduce((acc, x) => acc + x, 0); + +console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.2.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.2.txt new file mode 100644 index 00000000000..c3063d2bcc7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.2.txt @@ -0,0 +1,11 @@ +const result = [1, 2, 3] + .map(x => x * 2) + .filter(x => x > 2); + +console.log(result); + +const result2 = [1, 2, 3] + .filter(x => x > 2) + .map(x => x * 2); + +console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.3.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.3.txt index 11f3d9c5869..0ac3a196070 100644 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.3.txt @@ -1,3 +1,13 @@ const result = [1, 2, 3] .map(x => x * 2) - .filter \ No newline at end of file + .filter(x => x > 2) + .reduce((x, y) => x + y); + +console.log(result); + +const result2 = [1, 2, 3] + .map(x => x * 2) + .filter(x => x > 2) + .reduce((x, y) => x + y, 10); + +console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.rejected.4.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.4.txt similarity index 71% rename from src/test-llm-autocompletion/approvals/complex/chained-methods.rejected.4.txt rename to src/test-llm-autocompletion/approvals/complex/chained-methods.approved.4.txt index d13783a707f..5fae6c990d2 100644 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.4.txt @@ -1,13 +1,13 @@ const result = [1, 2, 3] .map(x => x * 2) .filter(x => x > 2) - .reduce((acc, x) => acc + x, 0); + .reduce((x, y) => x + y); console.log(result); const result2 = [1, 2, 3] .map(x => x * 2) .filter(x => x > 2) - .reduce((acc, x) => acc + x, 0); + .reduce((x, y) => x + y); console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.5.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.5.txt index bfceda5bc29..b2908223258 100644 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.5.txt @@ -1,4 +1,13 @@ const result = [1, 2, 3] .map(x => x * 2) .filter(x => x > 2) - .<<>> \ No newline at end of file + .reduce((acc, x) => acc + x, 0) + +console.log(result) + +const result2 = [1, 2, 3] + .map(x => x * 2) + .filter(x => x > 2) + .reduce((acc, x) => acc + x, 0) + +console.log(result2) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.6.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.6.txt deleted file mode 100644 index e99d21c2a71..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.6.txt +++ /dev/null @@ -1,3 +0,0 @@ -const result = [1, 2, 3] - .map(x => x * 2) - .filter(x => x > 2)<<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.7.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.7.txt deleted file mode 100644 index 413aef0edce..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.7.txt +++ /dev/null @@ -1,3 +0,0 @@ -const result = [1, 2, 3] - .map(x => x * 2) - .filter(x => x > 3) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.8.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.8.txt deleted file mode 100644 index 1697638551b..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.approved.8.txt +++ /dev/null @@ -1,3 +0,0 @@ -const result = [1, 2, 3] - .map(x => x * 2) - .reduce((acc, val) => acc + val, 0) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/chained-methods.rejected.2.txt b/src/test-llm-autocompletion/approvals/complex/chained-methods.rejected.2.txt deleted file mode 100644 index 43c26c528c4..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/chained-methods.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -const result = [1, 2, 3] - .map(x => x * 2) - .<<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.1.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.1.txt index 4bb355ec577..1b9c1b8d3d9 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.1.txt @@ -1,5 +1,13 @@ const config = { server: { port: 3000, + host: 'localhost' + }, + db: { host: 'localhost', - <<>> + port: 27017, + name: 'db' + } + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.10.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.10.txt index 12efbe584b7..6e663bb59b4 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.10.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.10.txt @@ -1,4 +1,11 @@ const config = { server: { port: 3000, - host: 'localhost', \ No newline at end of file + host: 'localhost' + }, + api: { + baseUrl: 'http://localhost:3000' + } + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.12.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.12.txt new file mode 100644 index 00000000000..36d5debd0b6 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.12.txt @@ -0,0 +1,11 @@ +const config = { + server: { + port: 3000, + host: 'localhost' + }, + api: { + url: 'http://localhost:3000' + } + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.13.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.13.txt new file mode 100644 index 00000000000..aa3932fd223 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.13.txt @@ -0,0 +1,11 @@ +const config = { + server: { + port: 3000, + host: 'localhost' + }, + api: { + url: 'https://api.github.com' + } + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.2.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.2.txt new file mode 100644 index 00000000000..b5a04bf2558 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.2.txt @@ -0,0 +1,13 @@ +const config = { + server: { + port: 3000, + host: 'localhost', + }, + db: { + host: 'localhost', + port: 27017, + name: 'db', + }, + }; + + export default config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.3.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.3.txt index 1df715c628c..1faeacebc26 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.3.txt @@ -1,4 +1,11 @@ const config = { server: { port: 3000, - host: 'localhost' \ No newline at end of file + host: 'localhost' + }, + api: { + prefix: '/api' + } + }; + + export default config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.4.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.4.txt new file mode 100644 index 00000000000..6421c5e4182 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.4.txt @@ -0,0 +1,13 @@ +const config = { + server: { + port: 3000, + host: 'localhost', + }, + db: { + host: 'localhost', + port: 27017, + name: 'db', + }, + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.5.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.5.txt index 92dd501b1ed..7cf109e5580 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.5.txt @@ -1,4 +1,11 @@ const config = { server: { port: 3000, - <<>>host: 'localhost', \ No newline at end of file + host: 'localhost' + }, + api: { + url: 'https://api.example.com' + } + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.6.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.6.txt new file mode 100644 index 00000000000..f06793ab62a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.6.txt @@ -0,0 +1,13 @@ +const config = { + server: { + port: 3000, + host: 'localhost' + }, + database: { + host: 'localhost', + port: 27017, + name: 'db' + } + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.7.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.7.txt index 851db8684dc..15428885ccc 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.7.txt @@ -2,5 +2,14 @@ const config = { server: { port: 3000, host: 'localhost', - protocol: 'http', - timeout: 30000 \ No newline at end of file + }, + db: { + host: 'localhost', + port: 5432, + database: 'postgres', + user: 'postgres', + password: 'postgres', + }, + }; + + export default config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.8.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.8.txt index eb7d19f2af3..53ddddf1e8f 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.8.txt @@ -1,5 +1,11 @@ const config = { server: { port: 3000, - host: 'localhost', - protocol: 'http' \ No newline at end of file + host: 'localhost' + }, + api: { + prefix: '/api' + } + } + + export default config \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.9.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.9.txt index 5ddc2f25727..a772e66a31b 100644 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/complex/nested-object.approved.9.txt @@ -1,6 +1,11 @@ const config = { server: { port: 3000, - host: 'localhost' + host: 'localhost' + }, + api: { + url: 'http://localhost:3000/api' } -}; \ No newline at end of file + }; + + module.exports = config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.2.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.2.txt deleted file mode 100644 index c10c73e7044..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.2.txt +++ /dev/null @@ -1,4 +0,0 @@ -const config = { - server: { - port: 3000, - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.4.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.4.txt deleted file mode 100644 index 2a41222722c..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.4.txt +++ /dev/null @@ -1 +0,0 @@ -(no changes parsed) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.6.txt b/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.6.txt deleted file mode 100644 index e01a8141a3f..00000000000 --- a/src/test-llm-autocompletion/approvals/complex/nested-object.rejected.6.txt +++ /dev/null @@ -1,6 +0,0 @@ -const config = { - server: { - port: 3000, - host: 'localhost', - }, -}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/context-aware/config-object-property.approved.1.txt b/src/test-llm-autocompletion/approvals/context-aware/config-object-property.approved.1.txt new file mode 100644 index 00000000000..c63b436c730 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/config-object-property.approved.1.txt @@ -0,0 +1,16 @@ +import { ServerConfig, createServer } from './config/server-config'; + +const config: ServerConfig = { + port: 3000, + host: 'localhost', + cors: { + origin: '*', + methods: ['GET', 'POST'], + }, + logging: { + level: 'info', + }, +}; + +const server = createServer(config); +server.start(); diff --git a/src/test-llm-autocompletion/approvals/context-aware/interface-implementation.approved.1.txt b/src/test-llm-autocompletion/approvals/context-aware/interface-implementation.approved.1.txt new file mode 100644 index 00000000000..e84e7b98f97 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/interface-implementation.approved.1.txt @@ -0,0 +1,7 @@ +import { Order, OrderStatus } from '../types/order'; + +function processOrder(order: Order): void { + if (order.status === OrderStatus.Pending) { + // Process pending order + } +} diff --git a/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.2.txt b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.2.txt new file mode 100644 index 00000000000..b86da6f76d8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.2.txt @@ -0,0 +1,15 @@ +import { UserService } from './services/user-service'; + +const userService = new UserService(); +const user = userService.getUser(); + +const userName = document.querySelector('.user-name'); +const userEmail = document.querySelector('.user-email'); + +if (userName) { + userName.innerHTML = user.name; +} + +if (userEmail) { + userEmail.innerHTML = user.email; +} diff --git a/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.3.txt b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.3.txt new file mode 100644 index 00000000000..dd3c9941196 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.3.txt @@ -0,0 +1,12 @@ +import { UserService } from './services/user-service'; + +const userService = new UserService(); +const user = userService.getUser(); + +const userName = document.querySelector('#user-name'); +const userEmail = document.querySelector('#user-email'); + +if (userName && userEmail) { + userName.innerHTML = user.name; + userEmail.innerHTML = user.email; +} diff --git a/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.4.txt b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.4.txt new file mode 100644 index 00000000000..b2602ac1d6c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.approved.4.txt @@ -0,0 +1,9 @@ +import { UserService } from './services/user-service'; + +const userService = new UserService(); +const user = userService.getUser(); + +const userName = document.getElementById('user-name'); +if (userName) { + userName.innerHTML = user.name; +} diff --git a/src/test-llm-autocompletion/approvals/context-aware/method-invocation.rejected.1.txt b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.rejected.1.txt new file mode 100644 index 00000000000..d2d5046bc63 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/method-invocation.rejected.1.txt @@ -0,0 +1,10 @@ +import { UserService } from './services/user-service'; + +const userService = new UserService(); +const user = userService.getUser(); + +console.log(user); + +const user2 = userService.getUser(); + +console.log(user2); diff --git a/src/test-llm-autocompletion/approvals/context-aware/utility-function-call.approved.1.txt b/src/test-llm-autocompletion/approvals/context-aware/utility-function-call.approved.1.txt new file mode 100644 index 00000000000..6dd0ff8263e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/context-aware/utility-function-call.approved.1.txt @@ -0,0 +1,17 @@ +import { formatPrice, formatDate } from '../utils/formatters'; + +interface ProductCardProps { + name: string; + price: number; + releaseDate: Date; +} + +export function ProductCard({ name, price, releaseDate }: ProductCardProps) { + return ( +
+

{name}

+

{formatPrice(price)}

+

Released: {formatDate(releaseDate)}

+
+ ); +} diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.1.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.1.txt index 78237758d62..403004b870b 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.1.txt @@ -1,2 +1,3 @@ for (let i = 0; i < 10; i++) { + console.log(i); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.2.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.2.txt deleted file mode 100644 index b0ac723d2f5..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - <<>> -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.3.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.3.txt deleted file mode 100644 index 329063333a1..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.3.txt +++ /dev/null @@ -1 +0,0 @@ -for (let i = 0; i < 10; i++) { <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.4.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.4.txt deleted file mode 100644 index f2bdb7a14ac..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.4.txt +++ /dev/null @@ -1 +0,0 @@ -for (let i = 0; i < 10; i++) {} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.5.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.5.txt deleted file mode 100644 index 8180c1472c6..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.5.txt +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - // loop body -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.6.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.6.txt deleted file mode 100644 index 403004b870b..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.6.txt +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - console.log(i); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.7.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.7.txt deleted file mode 100644 index b81b3dc09b1..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.7.txt +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.8.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.8.txt deleted file mode 100644 index 3c0a57e5b2a..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.approved.8.txt +++ /dev/null @@ -1,3 +0,0 @@ -for (let i = 0; i < 10; i++) { - console.log(i); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.1.txt index 6ee080ae5af..edf5d54d9b1 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.1.txt @@ -1,3 +1,12 @@ arr = [1, 2, 3, 4, 5] arr.each do |item| - puts item \ No newline at end of file + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item if item > 3 } + +arr.each do |item| + puts item if item > 3 +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.10.txt new file mode 100644 index 00000000000..9f5dd0836f7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.10.txt @@ -0,0 +1,10 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each_with_index do |item, index| + puts "#{index}: #{item}" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.11.txt new file mode 100644 index 00000000000..936b5c79603 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.11.txt @@ -0,0 +1,10 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item.to_s + "!" } + +arr.each { |item| puts item.to_s + "!" if item > 3 } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.12.txt new file mode 100644 index 00000000000..87c2145ea85 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.12.txt @@ -0,0 +1,12 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item.to_s + " is an item" } + +arr.each do |item| + puts item.to_s + " is an item" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.2.txt new file mode 100644 index 00000000000..bd32d9de20d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.2.txt @@ -0,0 +1,8 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.3.txt deleted file mode 100644 index 32f27694118..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.3.txt +++ /dev/null @@ -1,4 +0,0 @@ -arr = [1, 2, 3, 4, 5] -arr.each do |item| - # do something with item - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.4.txt new file mode 100644 index 00000000000..23fe7b3f81e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.4.txt @@ -0,0 +1,10 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each_with_index do |item, index| + puts "#{index} - #{item}" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.5.txt index d8fd04eadcb..36535d8d4d5 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.5.txt @@ -1,4 +1,12 @@ arr = [1, 2, 3, 4, 5] arr.each do |item| - puts item - <<>> \ No newline at end of file + p item +end + +arr.each { |item| p item } + +arr.each { |item| p item + 2 } + +arr.each do |item| + p item + 2 +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.7.txt index 64999187e38..b1a1697dc86 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.7.txt @@ -1,3 +1,10 @@ arr = [1, 2, 3, 4, 5] arr.each do |item| - puts item \ No newline at end of file + p item +end + +arr.each { |item| p item } + +arr.each_with_index do |item, index| + p "#{index} - #{item}" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.9.txt similarity index 83% rename from src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.8.txt rename to src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.9.txt index edf5d54d9b1..9d3ff1fde37 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.approved.9.txt @@ -8,5 +8,7 @@ arr.each { |item| puts item } arr.each { |item| puts item if item > 3 } arr.each do |item| - puts item if item > 3 + if item > 3 + puts item + end end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.2.txt deleted file mode 100644 index 4f4649fad50..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -arr = [1, 2, 3, 4, 5] -arr.each do |item| - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.3.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.3.txt new file mode 100644 index 00000000000..f1d7c7e6b00 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.3.txt @@ -0,0 +1,12 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item.to_s + " is a cool number" } + +arr.each do |item| + puts item.to_s + " is a cool number" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.4.txt deleted file mode 100644 index fc14dbd539c..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.4.txt +++ /dev/null @@ -1,3 +0,0 @@ -arr = [1, 2, 3, 4, 5] -arr.each do |item| - console.log(item) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.6.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.6.txt index a2807ba3062..d3ca2af5944 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.6.txt @@ -1,3 +1,12 @@ arr = [1, 2, 3, 4, 5] arr.each do |item| -console.log(item); \ No newline at end of file + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.8.txt b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.8.txt new file mode 100644 index 00000000000..59a60e3b647 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/for-loop.rb.rejected.8.txt @@ -0,0 +1,60 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |item| + puts item +end + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item } + +arr.each { |item| puts item \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.1.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.1.txt index 4e5ed33c059..3fe4614ea8f 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.1.txt @@ -1,4 +1,9 @@ const x = 10; if (x > 5) { - <<>> -} \ No newline at end of file + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} + +// Output: +// x is greater than 5 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.10.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.10.txt deleted file mode 100644 index 37c3460791b..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.10.txt +++ /dev/null @@ -1,4 +0,0 @@ -const x = 10; -if (x > 5) { - -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.11.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.11.txt deleted file mode 100644 index 4ac86c028a2..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.11.txt +++ /dev/null @@ -1,4 +0,0 @@ -const x = 10; -if (x > 5) { - console.log("x is greater than 5"); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.2.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.2.txt index 7e6fa48d529..efb1fffc281 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.2.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.2.txt @@ -1,4 +1,8 @@ const x = 10; if (x > 5) { - // code here + let y = 20; + var z = 30; + console.log(x); + console.log(y); + console.log(z); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.3.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.3.txt deleted file mode 100644 index f597751e019..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.3.txt +++ /dev/null @@ -1,4 +0,0 @@ -const x = 10; -if (x > 5) { - // code block -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.4.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.4.txt index d47e7ba0b34..c5f86f5eb24 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.4.txt @@ -1,2 +1,6 @@ const x = 10; -if (x > 5) { \ No newline at end of file +if (x > 5) { + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.5.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.5.txt index 7e77d1d4427..211139e6e39 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.5.txt @@ -1,4 +1,4 @@ const x = 10; if (x > 5) { - // TODO: Add code here + console.log("x is greater than 5"); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.6.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.6.txt deleted file mode 100644 index 3d19d1c0287..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.6.txt +++ /dev/null @@ -1,3 +0,0 @@ -const x = 10; -if (x > 5) { -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.7.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.7.txt deleted file mode 100644 index a1e90194c36..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.7.txt +++ /dev/null @@ -1,2 +0,0 @@ -const x = 10; -if (x > 5) {} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.8.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.8.txt deleted file mode 100644 index 16f24fb8a06..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.8.txt +++ /dev/null @@ -1,4 +0,0 @@ -const x = 10; -if (x > 5) { - // Your code here -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.9.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.9.txt deleted file mode 100644 index 211139e6e39..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.approved.9.txt +++ /dev/null @@ -1,4 +0,0 @@ -const x = 10; -if (x > 5) { - console.log("x is greater than 5"); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.1.txt index b1e9c795b0a..ef2adb092d5 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.1.txt @@ -1,3 +1,18 @@ x = 10 if x > 5 - print("x is greater than 5") \ No newline at end of file + puts "x is greater than 5" +end + +if x > 8 + puts "x is greater than 8" +else + puts "x is not greater than 8" +end + +if x > 10 + puts "x is greater than 10" +elsif x < 10 + puts "x is less than 10" +else + puts "x is equal to 10" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.10.txt deleted file mode 100644 index 98631856fe5..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.10.txt +++ /dev/null @@ -1,4 +0,0 @@ -x = 10 -if x > 5 - - print("x is greater than 5") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.11.txt deleted file mode 100644 index 04c5803ace9..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.11.txt +++ /dev/null @@ -1,4 +0,0 @@ -x = 10 -if x > 5 - print("x is greater than 5") - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.12.txt deleted file mode 100644 index 2eab90e398c..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.12.txt +++ /dev/null @@ -1,3 +0,0 @@ -x = 10 -if x > 5 - print("x is greater than 5") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.13.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.13.txt deleted file mode 100644 index 5ee9ba90540..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.13.txt +++ /dev/null @@ -1,3 +0,0 @@ -x = 10 -if x > 5 - puts "x is greater than 5" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.2.txt new file mode 100644 index 00000000000..36a9fb1df5f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.2.txt @@ -0,0 +1,12 @@ +x = 10 +if x > 5 + puts "x is greater than 5" +end + +if x > 8 + puts "x is also greater than 8" +end + +if x > 10 + puts "x is greater than 10" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.3.txt index e6de2b0fd5b..d25ff3d8bb1 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.3.txt @@ -1,3 +1,18 @@ x = 10 if x > 5 - console.log("x is greater than 5") \ No newline at end of file + puts "x is greater than 5" +end + +if x > 8 + puts "x is greater than 8" +else + puts "x is not greater than 8" +end + +if x > 10 + puts "x is greater than 10" +elsif x < 10 + puts "x is less than 10" +else + puts "x is 10" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.14.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.4.txt similarity index 53% rename from src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.14.txt rename to src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.4.txt index 46cd389e2ed..a43ec8bc280 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.14.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.4.txt @@ -7,4 +7,12 @@ if x > 8 puts "x is greater than 8" else puts "x is not greater than 8" +end + +if x > 10 + puts "x is greater than 10" +elsif x <= 2 + puts "x is 1 or 2" +else + puts "x is between 3 and 9" end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.5.txt index f18748bd41a..ee1166837e7 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.5.txt @@ -1,3 +1,12 @@ x = 10 if x > 5 - console.log(x) \ No newline at end of file + puts "x is greater than 5" +end + +if x > 8 + puts "x is also greater than 8" +end + +if x > 10 + puts "x is also greater than 10" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.7.txt deleted file mode 100644 index 69b073ae063..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.7.txt +++ /dev/null @@ -1,3 +0,0 @@ -x = 10 -if x > 5: - print("x is greater than 5") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.9.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.9.txt deleted file mode 100644 index 877308b375c..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.approved.9.txt +++ /dev/null @@ -1,4 +0,0 @@ -x = 10 -if x > 5: - print("x is greater than 5") - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.2.txt deleted file mode 100644 index 5510e919c99..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -x = 10 -if x > 5 - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.4.txt deleted file mode 100644 index 683929e62ba..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.4.txt +++ /dev/null @@ -1,3 +0,0 @@ -x = 10 -if x > 5 - // Your code here \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.6.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.6.txt deleted file mode 100644 index 5a02a290605..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.6.txt +++ /dev/null @@ -1,3 +0,0 @@ -x = 10 -if x > 5 - console.log("x is greater than 5") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.8.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.8.txt deleted file mode 100644 index b5c8998a6db..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rb.rejected.8.txt +++ /dev/null @@ -1,5 +0,0 @@ -x = 10 -if x > 5 -{ - console.log("x is greater than 5"); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.3.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.3.txt new file mode 100644 index 00000000000..a5e1df51e85 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.3.txt @@ -0,0 +1,13 @@ +const x = 10; +if (x > 5) { + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} + +const y = 10; +if (y > 5) { + console.log("y is greater than 5"); +} else { + console.log("y is less than or equal to 5"); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.6.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.6.txt new file mode 100644 index 00000000000..73d03e7d83e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.6.txt @@ -0,0 +1,17 @@ +const x = 10; +if (x > 5) { + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} + +// Output: x is greater than 5 + +const y = 3; +if (y > 5) { + console.log("y is greater than 5"); +} else { + console.log("y is less than or equal to 5"); +} + +// Output: y is less than or equal to 5 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.7.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.7.txt new file mode 100644 index 00000000000..0a8286beb53 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.7.txt @@ -0,0 +1,13 @@ +const x = 10; +if (x > 5) { + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} + +const y = 3; +if (y > 5) { + console.log("y is greater than 5"); +} else { + console.log("y is less than or equal to 5"); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.8.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.8.txt new file mode 100644 index 00000000000..a274cff6839 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.8.txt @@ -0,0 +1,15 @@ +const x = 10; +if (x > 5) { + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} + +const y = 10; +if (y > 5) { + console.log("y is greater than 5"); +} else if (y < 5) { + console.log("y is less than 5"); +} else { + console.log("y is equal to 5"); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.9.txt b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.9.txt new file mode 100644 index 00000000000..5d593416f45 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/if-statement.rejected.9.txt @@ -0,0 +1,15 @@ +const x = 10; +if (x > 5) { + console.log("x is greater than 5"); +} else { + console.log("x is less than or equal to 5"); +} + +const y = 10; +if (y > 5) { + console.log("y is greater than 5"); +} else if (y === 5) { + console.log("y is equal to 5"); +} else { + console.log("y is less than 5"); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.1.txt index 2f04d9ba7af..557ddc679cc 100644 --- a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.1.txt @@ -1,4 +1,10 @@ def calculate_total(items) sum = 0 items.each { |item| sum += item } - return sum \ No newline at end of file + return sum +end + +def calculate_total_with_tax(items) + sum = calculate_total(items) + sum * 1.08 +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.10.txt new file mode 100644 index 00000000000..fe1cacaad0d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.10.txt @@ -0,0 +1,10 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items, tax_rate) + sum = calculate_total(items) + return sum * (1 + tax_rate) +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.11.txt new file mode 100644 index 00000000000..b8f7f950e40 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.11.txt @@ -0,0 +1,17 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_tax(items) + tax = 0 + items.each { |item| tax += item * 0.08 } + return tax +end + +def calculate_total_with_tax(items) + total = calculate_total(items) + tax = calculate_tax(items) + return total + tax +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.12.txt new file mode 100644 index 00000000000..aae84f6aadc --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.12.txt @@ -0,0 +1,10 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items) + sum = calculate_total(items) + sum * 1.10 +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.2.txt new file mode 100644 index 00000000000..97fc330c32e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.2.txt @@ -0,0 +1,10 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items, tax_rate) + sum = calculate_total(items) + sum * (1 + tax_rate) +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.3.txt new file mode 100644 index 00000000000..e732780f55b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.3.txt @@ -0,0 +1,10 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items, tax_rate) + total = calculate_total(items) + total + (total * tax_rate) +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.4.txt new file mode 100644 index 00000000000..0a40fa68e96 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.4.txt @@ -0,0 +1,12 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_2(items) + items.inject(0) { |sum, item| sum += item } +end + +puts calculate_total([1, 2, 3, 4, 5]) +puts calculate_total_2([1, 2, 3, 4, 5]) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.5.txt new file mode 100644 index 00000000000..ab8bf3fee84 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.5.txt @@ -0,0 +1,10 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items, tax_rate) + total = calculate_total(items) + total * (1 + tax_rate) +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.6.txt new file mode 100644 index 00000000000..e2cc698609c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.6.txt @@ -0,0 +1,10 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items) + tax_rate = 1.07 + calculate_total(items) * tax_rate +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.7.txt new file mode 100644 index 00000000000..b8bbab21d12 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.7.txt @@ -0,0 +1,19 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_discount(items) + items.each do |item| + if item > 100 + item = item * 0.9 + end + end + return items +end + +def calculate_total_with_discount(items) + items = calculate_discount(items) + return calculate_total(items) +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.8.txt new file mode 100644 index 00000000000..270b00b6668 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.8.txt @@ -0,0 +1,11 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items, tax_rate) + sum = calculate_total(items) + sum += sum * tax_rate + return sum +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.9.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.9.txt new file mode 100644 index 00000000000..e9749c8638c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.approved.9.txt @@ -0,0 +1,11 @@ +def calculate_total(items) + sum = 0 + items.each { |item| sum += item } + return sum +end + +def calculate_total_with_tax(items) + sum = calculate_total(items) + tax = sum * 0.1 + return sum + tax +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.rejected.2.txt deleted file mode 100644 index 5a9268c5e83..00000000000 --- a/src/test-llm-autocompletion/approvals/control-flow/return-statement.rb.rejected.2.txt +++ /dev/null @@ -1,17 +0,0 @@ -def calculate_total(items) - sum = 0 - items.each { |item| sum += item } - return sum -end - -def calculate_tax(items) - tax = 0 - items.each { |item| tax += item * 0.09 } - return tax -end - -def calculate_tip(items) - tip = 0 - items.each { |item| tip += item * 0.15 } - return tip -end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.1.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.1.txt index 24e70be6383..9090d344b7c 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.1.txt @@ -1,3 +1,7 @@ const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price \ No newline at end of file + const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); + return acc + orderTotal; +}, 0); + +console.log(totalRevenue); // 45 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.2.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.2.txt new file mode 100644 index 00000000000..221bc25a8a1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.2.txt @@ -0,0 +1,12 @@ +const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; +const totalRevenue = orders.reduce((acc, order) => { + const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); + return acc + orderTotal; +}, 0); + +console.log(totalRevenue); // 45 + +// Explanation: +// 1. The outer reduce iterates over each order. +// 2. For each order, the inner reduce calculates the total price of all items in that order. +// 3. The outer reduce accumulates the total revenue by adding the total of each order to the accumulator. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.3.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.3.txt index e60653520e4..de070566a5a 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.3.txt @@ -1,3 +1,16 @@ const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); \ No newline at end of file + const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); + return acc + orderTotal; +}, 0); + +console.log(totalRevenue); // 45 + +// 1. acc = 0, order = {id: 1, items: [{price: 10}, {price: 20}]} +// orderTotal = 10 + 20 = 30 +// acc = 0 + 30 = 30 +// 2. acc = 30, order = {id: 2, items: [{price: 15}]} +// orderTotal = 15 +// acc = 30 + 15 = 45 +// 3. acc = 45, no more orders +// return 45 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.4.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.4.txt new file mode 100644 index 00000000000..6254c515185 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.4.txt @@ -0,0 +1,16 @@ +const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; +const totalRevenue = orders.reduce((acc, order) => { + const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); + return acc + orderTotal; +}, 0); +console.log(totalRevenue); // 45 + +// const orders = [ +// {id: 1, items: [{price: 10}, {price: 20}]}, +// {id: 2, items: [{price: 15}]} +// ]; +// const totalRevenue = orders.reduce((acc, order) => { +// const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); +// return acc + orderTotal; +// }, 0); +// console.log(totalRevenue); // 45 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.5.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.5.txt index 8fd620f9900..c1cb66b1043 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.5.txt @@ -1,3 +1,14 @@ const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0), 0); \ No newline at end of file + const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); + return acc + orderTotal; +}, 0); + +console.log(totalRevenue); // 45 + +// 1. acc = 0, order = {id: 1, items: [{price: 10}, {price: 20}]} +// 2. orderTotal = 10 + 20 = 30 +// 3. acc = 0 + 30 = 30 +// 4. acc = 30, order = {id: 2, items: [{price: 15}]} +// 5. orderTotal = 15 +// 6. acc = 30 + 15 = 45 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.6.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.6.txt index f2ce5287eb3..648d848b644 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.6.txt @@ -2,4 +2,14 @@ const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{pri const totalRevenue = orders.reduce((acc, order) => { const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); return acc + orderTotal; -}, 0); \ No newline at end of file +}, 0); +console.log(totalRevenue); // 45 + +// 1. acc = 0, order = {id: 1, items: [{price: 10}, {price: 20}]} +// orderTotal = 10 + 20 = 30 +// acc = 0 + 30 = 30 +// 2. acc = 30, order = {id: 2, items: [{price: 15}]} +// orderTotal = 15 +// acc = 30 + 15 = 45 +// 3. acc = 45, no more orders +// return 45 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.7.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.7.txt deleted file mode 100644 index 29369d8da61..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.7.txt +++ /dev/null @@ -1,5 +0,0 @@ -const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; -const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); - return acc + orderTotal; - }, 0); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.8.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.8.txt deleted file mode 100644 index 21a27a60782..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.8.txt +++ /dev/null @@ -1,3 +0,0 @@ -const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; -const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.9.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.9.txt deleted file mode 100644 index 9090d344b7c..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.approved.9.txt +++ /dev/null @@ -1,7 +0,0 @@ -const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; -const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price, 0); - return acc + orderTotal; -}, 0); - -console.log(totalRevenue); // 45 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.rejected.2.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.rejected.2.txt deleted file mode 100644 index 1e0d5bdedc8..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; -const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => sum + item.price; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.rejected.4.txt b/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.rejected.4.txt deleted file mode 100644 index 08e23adbfbe..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/array-reduce-complex.rejected.4.txt +++ /dev/null @@ -1,3 +0,0 @@ -const orders = [{id: 1, items: [{price: 10}, {price: 20}]}, {id: 2, items: [{price: 15}]}]; -const totalRevenue = orders.reduce((acc, order) => { - const orderTotal = order.items.reduce((sum, item) => <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.1.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.1.txt deleted file mode 100644 index 90af9f3e4a6..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.1.txt +++ /dev/null @@ -1,5 +0,0 @@ -const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; -const result = data - .filter(n => n % 2 === 0) - .map(n => n * 2) - .reduce((acc, n) => acc + n, 0) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.3.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.3.txt index 621a924c267..dc996ec0c61 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.3.txt @@ -2,4 +2,10 @@ const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const result = data .filter(n => n % 2 === 0) .map(n => n * 2) - .reduce((acc, n) => acc + n \ No newline at end of file + .reduce((acc, n) => acc + n, 0); + +console.log(result); // 60 + +// filter: 2, 4, 6, 8, 10 +// map: 4, 8, 12, 16, 20 +// reduce: 4 + 8 + 12 + 16 + 20 = 60 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.5.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.5.txt deleted file mode 100644 index 8380fc67ba4..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.5.txt +++ /dev/null @@ -1,5 +0,0 @@ -const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; -const result = data - .filter(n => n % 2 === 0) - .map(n => n * 2) - .reduce((acc, n) => acc + n, 0); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.7.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.7.txt deleted file mode 100644 index e1814874dc5..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.approved.7.txt +++ /dev/null @@ -1,5 +0,0 @@ -const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; -const result = data - .filter(n => n % 2 === 0) - .map(n => n * 2) - .reduce((acc, n) => acc + n, 0 \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.6.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.1.txt similarity index 88% rename from src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.6.txt rename to src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.1.txt index 59120cc42b3..f9774df7e28 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.1.txt @@ -2,7 +2,7 @@ const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const result = data .filter(n => n % 2 === 0) .map(n => n * 2) - .reduce((acc, n) => acc + n, 0); + .reduce((acc, n) => acc + n); console.log(result); diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.2.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.2.txt index 59bf7720ba4..59120cc42b3 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.2.txt @@ -2,4 +2,13 @@ const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const result = data .filter(n => n % 2 === 0) .map(n => n * 2) - .reduce((acc, n) => acc + n) \ No newline at end of file + .reduce((acc, n) => acc + n, 0); + +console.log(result); + +const result2 = data + .filter(n => n % 2 === 0) + .map(n => n * 2) + .reduce((acc, n) => acc + n, 0); + +console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.4.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.4.txt index e7dcbb73ef2..0275a585515 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.4.txt @@ -2,4 +2,15 @@ const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const result = data .filter(n => n % 2 === 0) .map(n => n * 2) - .reduce((acc, n) => <<>> \ No newline at end of file + .reduce((acc, n) => acc + n, 0); + +console.log(result); + +const result2 = data.reduce((acc, n) => { + if (n % 2 === 0) { + return acc + n * 2; + } + return acc; +}, 0); + +console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.5.txt b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.5.txt new file mode 100644 index 00000000000..6dd07c339c4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/data-pipeline.rejected.5.txt @@ -0,0 +1,16 @@ +const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +const result = data + .filter(n => n % 2 === 0) + .map(n => n * 2) + .reduce((acc, n) => acc + n, 0); + +console.log(result); + +const result2 = data.reduce((acc, n) => { + if (n % 2 === 0) { + acc += n * 2; + } + return acc; +}, 0); + +console.log(result2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.1.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.1.txt index 86e401921c5..f7a973b6063 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.1.txt @@ -1,4 +1,8 @@ const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; const userDTOs = users.map(user => ({ id: user.id, - fullName: `${user.firstName} ${user.lastName}` \ No newline at end of file + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.10.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.10.txt new file mode 100644 index 00000000000..86189c5d15a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.10.txt @@ -0,0 +1,10 @@ +const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; +const userDTOs = users.map(user => ({ + id: user.id, + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +// In this example, the map function is used to transform each user object into a new object with only the id and fullName properties. The resulting array of objects is stored in the userDTOs variable. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.rejected.2.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.2.txt similarity index 50% rename from src/test-llm-autocompletion/approvals/data-transformation/object-mapping.rejected.2.txt rename to src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.2.txt index 74fee0d06db..4d2ab88c122 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.2.txt @@ -1,4 +1,8 @@ const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; const userDTOs = users.map(user => ({ id: user.id, - fullName: <<>> \ No newline at end of file + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{ id: 1, fullName: 'John Doe' }, { id: 2, fullName: 'Jane Smith' }] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.3.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.3.txt index 60fd9b676a1..7722209ba9e 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.3.txt @@ -1,4 +1,12 @@ const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; const userDTOs = users.map(user => ({ id: user.id, - fullName: user.firstName + ' ' + user.lastName \ No newline at end of file + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +// 1. The map() method is used to iterate over the users array. +// 2. For each user object, a new object is created with the id property and a new fullName property that combines the firstName and lastName properties of the user object. +// 3. The resulting array of userDTOs is stored in the userDTOs variable and logged to the console. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.4.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.4.txt new file mode 100644 index 00000000000..8920ca06bf9 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.4.txt @@ -0,0 +1,10 @@ +const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; +const userDTOs = users.map(user => ({ + id: user.id, + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +// This code maps the users array to a new array of objects with only the id and fullName properties. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.5.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.5.txt index 3ae77d9942d..4ffa69da76f 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.5.txt @@ -1,4 +1,12 @@ const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; const userDTOs = users.map(user => ({ id: user.id, - fullName: `${user.firstName} ${user.lastName}`}) \ No newline at end of file + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +// 1. The map function is used to iterate over the users array. +// 2. For each user, a new object is created with the id property and a new fullName property that combines the firstName and lastName properties of the user. +// 3. The resulting array of userDTOs is then logged to the console. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.6.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.6.txt index 4d2ab88c122..f2e7580cc4e 100644 --- a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.6.txt @@ -5,4 +5,6 @@ const userDTOs = users.map(user => ({ })); console.log(userDTOs); -// Output: [{ id: 1, fullName: 'John Doe' }, { id: 2, fullName: 'Jane Smith' }] \ No newline at end of file +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +// In this example, we have an array of user objects with id, firstName, and lastName properties. We use the map method to transform each user object into a new object with id and fullName properties. The fullName property is created by concatenating the firstName and lastName properties of the original user object. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.7.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.7.txt new file mode 100644 index 00000000000..60c5e8dae3f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.7.txt @@ -0,0 +1,10 @@ +const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; +const userDTOs = users.map(user => ({ + id: user.id, + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +// The map() method is used to transform each user object into a new object with only the id and fullName properties. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.8.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.8.txt new file mode 100644 index 00000000000..569281f9b0f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.8.txt @@ -0,0 +1,14 @@ +const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; +const userDTOs = users.map(user => ({ + id: user.id, + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [{id: 1, fullName: 'John Doe'}, {id: 2, fullName: 'Jane Smith'}] + +const numbers = [1, 2, 3, 4, 5]; +const squaredNumbers = numbers.map(num => num * num); + +console.log(squaredNumbers); +// Output: [1, 4, 9, 16, 25] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.9.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.9.txt new file mode 100644 index 00000000000..9158e707a77 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.approved.9.txt @@ -0,0 +1,11 @@ +const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; +const userDTOs = users.map(user => ({ + id: user.id, + fullName: `${user.firstName} ${user.lastName}` +})); + +console.log(userDTOs); +// Output: [ +// { id: 1, fullName: 'John Doe' }, +// { id: 2, fullName: 'Jane Smith' } +// ] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.rejected.4.txt b/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.rejected.4.txt deleted file mode 100644 index 987c7078341..00000000000 --- a/src/test-llm-autocompletion/approvals/data-transformation/object-mapping.rejected.4.txt +++ /dev/null @@ -1,4 +0,0 @@ -const users = [{id: 1, firstName: 'John', lastName: 'Doe'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}]; -const userDTOs = users.map(user => ({ - id: user.id, - fullName: \`${user.firstName} ${user.lastName}\` \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.1.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.1.txt index 0671a452788..2e1658f0332 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.1.txt @@ -2,7 +2,15 @@ fetchUser(userId) .then(user => { return processUser(user); }) - .catch(error => { - console.error('Error fetching user:', error); - throw error; - }) \ No newline at end of file + .catch(err => { + console.log(err); + }); + +async function showUser(userId) { + try { + const user = await fetchUser(userId); + const processedUser = await processUser(user); + } catch (err) { + console.log(err); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.10.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.10.txt deleted file mode 100644 index d9936a358a3..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.10.txt +++ /dev/null @@ -1,5 +0,0 @@ -fetchUser(userId) - .then(user => { - return processUser(user); - }) - .catch(error => handleError(error)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.11.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.2.txt similarity index 56% rename from src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.11.txt rename to src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.2.txt index 2e1658f0332..17d0b99b4bc 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.11.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.2.txt @@ -3,14 +3,14 @@ fetchUser(userId) return processUser(user); }) .catch(err => { - console.log(err); + // handle error }); -async function showUser(userId) { +async function showUserAvatar(userId) { try { const user = await fetchUser(userId); - const processedUser = await processUser(user); + const avatar = await processUser(user); } catch (err) { - console.log(err); + // handle error } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.3.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.3.txt index cc9d37f3702..bad3e0cc738 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.3.txt @@ -3,6 +3,17 @@ fetchUser(userId) return processUser(user); }) .catch(error => { - console.error('Error:', error); - throw error; - }) \ No newline at end of file + console.error(error); + }); + +async function fetchUser(userId) { + const response = await fetch(`https://api.example.com/users/${userId}`); + if (!response.ok) { + throw new Error('Failed to fetch user'); + } + return response.json(); +} + +async function processUser(user) { + console.log(user); +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.4.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.4.txt index 443b3f0da11..0162c494bc6 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.4.txt @@ -2,4 +2,9 @@ fetchUser(userId) .then(user => { return processUser(user); }) - .catch(error => { \ No newline at end of file + .catch(err => { + return fetchAdmin(); + }) + .then(help => { + console.log(help); + }); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.5.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.5.txt index eea06d717dd..0caeaf46df7 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.5.txt @@ -2,4 +2,6 @@ fetchUser(userId) .then(user => { return processUser(user); }) - .catch(error => { }) \ No newline at end of file + .catch(err => { + // handle error + }); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.6.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.6.txt index 3b5df100c5b..277b84f3487 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.6.txt @@ -2,6 +2,16 @@ fetchUser(userId) .then(user => { return processUser(user); }) - .catch(error => { - console.error('Error fetching user:', error); - }) \ No newline at end of file + .catch(err => { + console.log(err); + }); + +async function showUser(userId) { + try { + const user = await fetchUser(userId); + const processedUser = await processUser(user); + console.log(processedUser); + } catch (err) { + console.log(err); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.7.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.7.txt index 7437ea43f1e..09a66c7118e 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.7.txt @@ -2,6 +2,9 @@ fetchUser(userId) .then(user => { return processUser(user); }) - .catch(error => { - console.error('Error:', error); - }) \ No newline at end of file + .catch(err => { + return fetchAdmin(); + }) + .then(helpdeskMember => { + console.log('Helpdesk: ', helpdeskMember.name); + }); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.8.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.8.txt deleted file mode 100644 index 8fc29170d5a..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.8.txt +++ /dev/null @@ -1,8 +0,0 @@ -fetchUser(userId) - .then(user => { - return processUser(user); - }) - .catch((error) => { - console.error('Error fetching user:', error); - throw error; - }) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.9.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.9.txt deleted file mode 100644 index 8ad60ab6428..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.approved.9.txt +++ /dev/null @@ -1,7 +0,0 @@ -fetchUser(userId) - .then(user => { - return processUser(user); - }) - .catch((error) => { - handleError(error); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.rejected.2.txt b/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.rejected.2.txt deleted file mode 100644 index 085f054eb5c..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/promise-rejection.rejected.2.txt +++ /dev/null @@ -1,5 +0,0 @@ -fetchUser(userId) - .then(user => { - return processUser(user); - }) - .catch(<<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.1.txt index 538e05f0af3..605ba898430 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.1.txt @@ -1,5 +1,9 @@ def process_data(data) begin result = JSON.parse(data) - return result - <<>> \ No newline at end of file + result['status'] = 'success' + rescue JSON::ParserError => e + result = { 'status' => 'error', 'message' => e.message } + end + result.to_json + end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.10.txt index 177d0d949e5..f0d3a7218ec 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.10.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.10.txt @@ -1,5 +1,8 @@ def process_data(data) begin result = JSON.parse(data) - result - <<>> + puts result + rescue JSON::ParserError => e + puts "Bad JSON: #{e.message}" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.11.txt new file mode 100644 index 00000000000..53e5515ca8b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.11.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "ok" + return result + rescue JSON::ParserError => e + return {"status" => "error", "message" => "Invalid JSON"} + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.12.txt index 9009f88009d..59e518565b6 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.12.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.12.txt @@ -1,7 +1,9 @@ def process_data(data) begin result = JSON.parse(data) - rescue JSON::ParserError => e - puts "Error parsing JSON: #{e.message}" - return nil - end \ No newline at end of file + result["status"] = "OK" + result.to_json + rescue JSON::ParserError => e + { "status" => "ERROR", "message" => "Invalid JSON" }.to_json + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.11.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.13.txt similarity index 59% rename from src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.11.txt rename to src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.13.txt index cf115e9f2e5..ff15e0840f1 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.11.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.13.txt @@ -1,7 +1,9 @@ def process_data(data) begin result = JSON.parse(data) - rescue JSON::ParserError => e + return result + rescue JSON::ParserError => e puts "Error parsing JSON: #{e.message}" - nil - end \ No newline at end of file + return nil + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.14.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.14.txt index 4443539720b..b65ae11b326 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.14.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.14.txt @@ -1,7 +1,9 @@ def process_data(data) begin result = JSON.parse(data) - rescue JSON::ParserError => e - puts "Error parsing JSON: #{e.message}" - nil - end \ No newline at end of file + result["status"] = "ok" + rescue JSON::ParserError => e + result = { "status" => "error", "message" => e.message } + end + result.to_json +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.15.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.15.txt new file mode 100644 index 00000000000..b9b67ac9715 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.15.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "ok" + return result.to_json + rescue JSON::ParserError => e + return { "status" => "error", "message" => "Invalid JSON" }.to_json + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.16.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.16.txt index 6fde4c08843..36d41fab251 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.16.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.16.txt @@ -1,9 +1,9 @@ def process_data(data) begin result = JSON.parse(data) + result["status"] = "success" rescue JSON::ParserError => e - puts "Error parsing JSON: #{e.message}" - nil + result = { "status" => "error", "message" => "Invalid JSON format" } end - end -end \ No newline at end of file + result.to_json + end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.17.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.17.txt index f74e8472c48..63839b81991 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.17.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.17.txt @@ -1,12 +1,10 @@ def process_data(data) begin result = JSON.parse(data) - if result.is_a?(Hash) - result.each do |key, value| - puts "#{key}: #{value}" - end + result.each do |item| + puts item['name'] end rescue JSON::ParserError => e - puts "Invalid JSON data: #{e.message}" + puts "Error parsing JSON: #{e.message}" end end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.18.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.18.txt index 39d1d44efc7..7183cb13a75 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.18.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.18.txt @@ -1,8 +1,9 @@ def process_data(data) begin result = JSON.parse(data) - rescue JSON::ParserError => e - puts "Error parsing JSON: #{e.message}" - nil - end - end \ No newline at end of file + result["status"] = "success" + return result + rescue JSON::ParserError => e + return { "status" => "error", "message" => "Invalid JSON format" } + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.19.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.19.txt new file mode 100644 index 00000000000..ca6785216ae --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.19.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "OK" + return result + rescue JSON::ParserError => e + return { "status" => "ERROR", "message" => "Invalid JSON" } + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.2.txt new file mode 100644 index 00000000000..8d60a45de17 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.2.txt @@ -0,0 +1,8 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["name"] + rescue JSON::ParserError + "Invalid JSON" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.20.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.20.txt new file mode 100644 index 00000000000..c923cb0047f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.20.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "success" + return result.to_json + rescue JSON::ParserError => e + return {status: "error", message: "Invalid JSON format"}.to_json + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.21.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.21.txt new file mode 100644 index 00000000000..03cc21ce8ba --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.21.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "success" + rescue JSON::ParserError => e + result = { "status" => "error", "message" => e.message } + end + result.to_json +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.22.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.22.txt new file mode 100644 index 00000000000..bd088a79b1a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.22.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "success" + return result + rescue JSON::ParserError + return {"status" => "error", "message" => "Invalid JSON"} + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.23.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.23.txt new file mode 100644 index 00000000000..4a3882923c4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.23.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "success" + return result + rescue JSON::ParserError => e + return {"status" => "error", "message" => "Invalid JSON format"} + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.24.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.24.txt new file mode 100644 index 00000000000..db4938e90bc --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.24.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "OK" + rescue JSON::ParserError => e + result = { "status" => "ERROR", "message" => e.message } + end + result.to_json +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.25.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.25.txt new file mode 100644 index 00000000000..1b009474c97 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.25.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "ok" + rescue JSON::ParserError + result = { "status" => "error", "message" => "Invalid JSON" } + end + result.to_json +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.26.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.26.txt new file mode 100644 index 00000000000..2f8ea43a3ae --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.26.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "ok" + rescue JSON::ParserError => e + result = { "status" => "error", "message" => "Invalid JSON" } + end + result.to_json + end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.27.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.27.txt new file mode 100644 index 00000000000..fa2284376df --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.27.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "ok" + return result + rescue JSON::ParserError => e + return {"status" => "error", "error" => e.message} + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.3.txt index f461f596673..ea2a087b348 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.3.txt @@ -1,5 +1,9 @@ def process_data(data) begin result = JSON.parse(data) + result['status'] = 'ok' rescue JSON::ParserError => e - <<>> \ No newline at end of file + result = { 'status' => 'error', 'error' => e.message } + end + result.to_json +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.4.txt new file mode 100644 index 00000000000..489f60ee424 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.4.txt @@ -0,0 +1,12 @@ +def process_data(data) + begin + result = JSON.parse(data) + if result.is_a?(Hash) + return result + else + raise "Invalid JSON format: Expected a Hash" + end + rescue JSON::ParserError => e + raise "Invalid JSON: #{e.message}" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.5.txt index 19d11641428..50cb700e8cb 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.5.txt @@ -1,5 +1,14 @@ def process_data(data) begin result = JSON.parse(data) - return result - end \ No newline at end of file + if result.is_a?(Hash) + result.each do |key, value| + puts "#{key}: #{value}" + end + else + puts "Invalid JSON data: Not a Hash" + end + rescue JSON::ParserError => e + puts "Invalid JSON data: #{e.message}" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.6.txt new file mode 100644 index 00000000000..7787427bd07 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.6.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "success" + return result + rescue JSON::ParserError => e + return { "status" => "error", "message" => "Invalid JSON data" } + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.7.txt index c03cf96ce61..0bfeb755408 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.7.txt @@ -1,5 +1,9 @@ def process_data(data) begin result = JSON.parse(data) - validate_data(result) - return result \ No newline at end of file + result["status"] = "success" + return result.to_json + rescue JSON::ParserError + return { "status" => "error", "message" => "Invalid JSON" }.to_json + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.8.txt new file mode 100644 index 00000000000..d6016b4cec8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.8.txt @@ -0,0 +1,10 @@ +def process_data(data) + begin + result = JSON.parse(data) + result.each do |key, value| + puts "#{key}: #{value}" + end + rescue JSON::ParserError => e + puts "Error parsing JSON: #{e.message}" + end +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.9.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.9.txt new file mode 100644 index 00000000000..7a252962c2b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.approved.9.txt @@ -0,0 +1,9 @@ +def process_data(data) + begin + result = JSON.parse(data) + result["status"] = "OK" + rescue JSON::ParserError => e + result = { "status" => "ERROR", "message" => e.message } + end + result.to_json +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.13.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.13.txt deleted file mode 100644 index b3aeef5f398..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.13.txt +++ /dev/null @@ -1,8 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - validate_data(result) - rescue JSON::ParserError => e - puts "Error parsing JSON: #{e.message}" - nil - end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.15.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.15.txt deleted file mode 100644 index 8d0da8923dd..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.15.txt +++ /dev/null @@ -1,5 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - result - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.2.txt deleted file mode 100644 index 76391179830..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.2.txt +++ /dev/null @@ -1,4 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.4.txt deleted file mode 100644 index 87ef463b0e7..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.4.txt +++ /dev/null @@ -1,4 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - result \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.6.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.6.txt deleted file mode 100644 index a681c323144..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.6.txt +++ /dev/null @@ -1,4 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - return result \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.8.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.8.txt deleted file mode 100644 index 2b6e9684ce3..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.8.txt +++ /dev/null @@ -1,5 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - result = JSON.parse(data) - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.9.txt b/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.9.txt deleted file mode 100644 index 9abbcf061da..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/rescue-handling.rb.rejected.9.txt +++ /dev/null @@ -1,8 +0,0 @@ -def process_data(data) - begin - result = JSON.parse(data) - return result - rescue JSON::ParserError => e - puts "Error parsing JSON: #{e.message}" - nil - end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.1.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.1.txt index f9bbe8efd16..b516481153b 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.1.txt @@ -1,5 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; - <<>> + console.log(result); + } catch (error) { + console.log('Bad string'); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.10.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.10.txt deleted file mode 100644 index 732ea7d8e9c..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.10.txt +++ /dev/null @@ -1,8 +0,0 @@ -function processData(data) { - try { - const result = JSON.parse(data); - return result; - } catch (error) { - console.error("Error parsing JSON:", error); - throw error; - } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.rejected.4.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.2.txt similarity index 53% rename from src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.rejected.4.txt rename to src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.2.txt index fbb5651ad8e..4531abb3ebd 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.2.txt @@ -1,9 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; + console.log(result); } catch (error) { - console.error('Error parsing data:', error); - throw error; + console.log("Error:", error.message); } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.3.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.3.txt index 44955adb4e6..ec500703f1f 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.3.txt @@ -1,4 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; \ No newline at end of file + console.log(result); + } catch (error) { + console.log("Bad string"); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.11.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.4.txt similarity index 52% rename from src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.11.txt rename to src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.4.txt index c4c7c19f1a3..c55fe574930 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.11.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.4.txt @@ -1,8 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; + console.log(result); } catch (error) { - console.error('Error parsing data:', error); - throw error; - } \ No newline at end of file + console.log("Invalid JSON"); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.5.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.5.txt index dd619069688..147b0b0e9a9 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.5.txt @@ -1,5 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; - } \ No newline at end of file + console.log(result); + } catch (error) { + console.log('Invalid JSON'); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.6.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.6.txt index 483b15b8f2f..a3068c22016 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.6.txt @@ -1,9 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; - } catch (error) { - console.error('Error processing data:', error); - throw error; + console.log(result); + } catch (e) { + console.log('Bad String'); } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.7.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.7.txt index a67f55707e3..b093a01b258 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.7.txt @@ -1,12 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - if (!result) { - throw new Error('Invalid data'); - } - return result; + console.log(result); } catch (error) { - console.error('Error processing data:', error); - throw error; + console.log('Bad String'); } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.8.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.8.txt index 3207e1b93c9..0197e63346a 100644 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.8.txt @@ -1,9 +1,8 @@ function processData(data) { try { const result = JSON.parse(data); - return result; + console.log(result); } catch (error) { - console.error('Error parsing JSON:', error); - throw error; + console.log("Bad String"); } } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.9.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.9.txt deleted file mode 100644 index 44497a6be38..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.approved.9.txt +++ /dev/null @@ -1,11 +0,0 @@ -function processData(data) { - try { - const result = JSON.parse(data); - if (result) { - return result; - } - } catch (error) { - console.error('Error parsing JSON:', error); - throw error; - } -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.rejected.2.txt b/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.rejected.2.txt deleted file mode 100644 index 450ba964f41..00000000000 --- a/src/test-llm-autocompletion/approvals/error-handling/try-catch-finally.rejected.2.txt +++ /dev/null @@ -1,4 +0,0 @@ -function processData(data) { - try { - const result = JSON.parse(data); - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.1.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.1.txt deleted file mode 100644 index c64ad578fd7..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.1.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet(<<>>) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.10.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.10.txt deleted file mode 100644 index aae104771f1..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.10.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet('John'); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.11.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.11.txt deleted file mode 100644 index 9434e1601ac..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.11.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet("John"); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.12.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.12.txt deleted file mode 100644 index 3ca5de24b62..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.12.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet("World" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.3.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.3.txt index 7370cbe060b..30add885095 100644 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.3.txt @@ -1,2 +1,2 @@ function greet(name) { return 'Hello ' + name; } -greet('John') \ No newline at end of file +greet('World'); // 'Hello World' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.5.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.5.txt deleted file mode 100644 index a8df1df6f40..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.5.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet('Alice') \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.7.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.7.txt deleted file mode 100644 index 73b079aaef2..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.7.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet(' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.8.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.8.txt deleted file mode 100644 index 83da098145f..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.8.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet('World'<<>>) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.9.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.9.txt deleted file mode 100644 index 9cdc2d02828..00000000000 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.approved.9.txt +++ /dev/null @@ -1,2 +0,0 @@ -function greet(name) { return 'Hello ' + name; } -greet('World') \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.1.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.1.txt new file mode 100644 index 00000000000..c3f1aa918ce --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.1.txt @@ -0,0 +1,12 @@ +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet(123); // 'Hello 123' +greet(true); // 'Hello true' +greet(); // 'Hello undefined' + +function greet(name) { + if (name === undefined) { + name = 'World'; + } + return 'Hello ' + name; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.10.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.10.txt new file mode 100644 index 00000000000..2611d6ff6dd --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.10.txt @@ -0,0 +1,11 @@ +function greet(name) { return 'Hello ' + name; } +greet('World'); // Hello World + +function greet(name) { return 'Hello ' + name; } +greet('World'); // Hello World + +function greet(name) { return 'Hello ' + name; } +greet('World'); // Hello World + +function greet(name) { return 'Hello ' + name; } +greet('World'); // Hello World \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.11.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.11.txt new file mode 100644 index 00000000000..11b5f9ca4fb --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.11.txt @@ -0,0 +1,11 @@ +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' + +function greet(name: string) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' + +function greet(name: string) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.2.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.2.txt index 2a41222722c..a8dbf69fda4 100644 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.2.txt +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.2.txt @@ -1 +1,11 @@ -(no changes parsed) \ No newline at end of file +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' + +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' + +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' + +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.4.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.4.txt index bfc94526cf4..b3474a6192a 100644 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.4.txt +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.4.txt @@ -1,2 +1,11 @@ function greet(name) { return 'Hello ' + name; } -greet("")]; \ No newline at end of file +greet('John'); // 'Hello John' +greet(5); // 'Hello 5' + +function greet(name) { + if (typeof name === 'string') { + return 'Hello ' + name; + } else { + return 'Hello'; + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.5.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.5.txt new file mode 100644 index 00000000000..7cecbea7974 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.5.txt @@ -0,0 +1,10 @@ +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' + +// Arrow function +const greet = (name) => { return 'Hello ' + name; } +greet('World'); // 'Hello World' + +// Arrow function with implicit return +const greet = (name) => 'Hello ' + name; +greet('World'); // 'Hello World' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.6.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.6.txt index 9b25bf6f3e2..0db9fea7bcb 100644 --- a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.6.txt +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.6.txt @@ -1,2 +1,15 @@ function greet(name) { return 'Hello ' + name; } -greet(<<>> \ No newline at end of file +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' + +function greet2(name: string) { return 'Hello ' + name; } +greet2('World'); // 'Hello World' +greet2('TypeScript'); // 'Hello TypeScript' + +function greet3(name: string) { return 'Hello ' + name; } +greet3('World'); // 'Hello World' +greet3('TypeScript'); // 'Hello TypeScript' + +function greet4(name: string) { return 'Hello ' + name; } +greet4('World'); // 'Hello World' +greet4('TypeScript'); // 'Hello TypeScript' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.7.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.7.txt new file mode 100644 index 00000000000..fa0fcfed9ef --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.7.txt @@ -0,0 +1,15 @@ +function greet(name) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' + +function greet(name: string) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' + +function greet(name: string) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' + +function greet(name: string) { return 'Hello ' + name; } +greet('World'); // 'Hello World' +greet('TypeScript'); // 'Hello TypeScript' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.8.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.8.txt new file mode 100644 index 00000000000..0407a782eb7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.8.txt @@ -0,0 +1,12 @@ +function greet(name) { return 'Hello ' + name; } +greet('John'); // 'Hello John' +greet(5); // 'Hello 5' + +function greet(name) { + if (name === undefined) { name = 'John'; } + return 'Hello ' + name; +} +greet('Amy'); // 'Hello Amy' +greet(); // 'Hello John' +greet(0); // 'Hello 0' +greet(false); // 'Hello false' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.9.txt b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.9.txt new file mode 100644 index 00000000000..6446ef37c28 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-call/function-call-args.rejected.9.txt @@ -0,0 +1,10 @@ +function greet(name) { return 'Hello ' + name; } +greet('John'); // 'Hello John' +greet('Jane'); // 'Hello Jane' + +function greet(name) { + if (name === undefined) { + name = 'John Doe'; + } + return 'Hello ' + name; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.1.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.1.txt index 28118363cb8..d086f6cbb20 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.1.txt @@ -1 +1,20 @@ -const add = (a, b) => \ No newline at end of file +const add = (a, b) => a + b; +const generateGreeting = (name = 'Anonymous') => `Hello ${name}!`; + +test('should add two numbers', () => { + const result = add(3, 4); + + expect(result).toBe(7); +}); + +test('should generate greeting from name', () => { + const result = generateGreeting('Mike'); + + expect(result).toBe('Hello Mike!'); +}); + +test('should generate greeting for no name', () => { + const result = generateGreeting(); + + expect(result).toBe('Hello Anonymous!'); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.10.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.10.txt new file mode 100644 index 00000000000..bf60f88dee2 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.10.txt @@ -0,0 +1,17 @@ +const add = (a, b) => a + b; +const generateGreeting = (name = 'Anonymous') => `Hello ${name}!`; + +test('should add two numbers', () => { + const result = add(3, 4); + expect(result).toBe(7); +}); + +test('should generate greeting from name', () => { + const result = generateGreeting('Mike'); + expect(result).toBe('Hello Mike!'); +}); + +test('should generate greeting for no name', () => { + const result = generateGreeting(); + expect(result).toBe('Hello Anonymous!'); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.11.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.11.txt new file mode 100644 index 00000000000..2c60e055cb6 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.11.txt @@ -0,0 +1,21 @@ +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return null; + } +}; + +export default operate; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.12.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.12.txt new file mode 100644 index 00000000000..99692939370 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.12.txt @@ -0,0 +1,45 @@ +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return 'Invalid operator'; + } +}; + +const display = document.querySelector('.display'); +const buttons = document.querySelectorAll('.btn'); + +let currentInput = ''; +let previousInput = ''; +let operation = null; +let resetScreen = false; + +buttons.forEach(button => { + button.addEventListener('click', () => { + const buttonText = button.textContent; + + if (buttonText === 'C') { + clear(); + } else if (buttonText === '=') { + calculate(); + } else if (['+', '-', '*', '/'].includes(buttonText)) { + handleOperator(buttonText); + } else { + handleNumber(buttonText); + } + }); +}); + +function handleNumber(number \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.13.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.13.txt new file mode 100644 index 00000000000..e19a6edd592 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.13.txt @@ -0,0 +1,24 @@ +const add = (a, b) => a + b; + +const subtract = (a, b) => a - b; + +const multiply = (a, b) => a * b; + +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return null; + } +}; + +export default operate; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.14.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.14.txt new file mode 100644 index 00000000000..e0f174ccf61 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.14.txt @@ -0,0 +1,18 @@ +const add = (a, b) => a + b; +const generateGreeting = (name = 'Anonymous') => `Hello ${name}!`; + +test('should add two numbers', () => { + const result = add(3, 4); + + expect(result).toBe(7); +}); + +test('should generate greeting from name', () => { + const result = generateGreeting('Mike'); + expect(result).toBe('Hello Mike!'); +}); + +test('should generate greeting for no name', () => { + const result = generateGreeting(); + expect(result).toBe('Hello Anonymous!'); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.15.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.15.txt new file mode 100644 index 00000000000..9ff2252f476 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.15.txt @@ -0,0 +1,19 @@ +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return 'Invalid operator'; + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.2.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.2.txt new file mode 100644 index 00000000000..0e1679a85c1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.2.txt @@ -0,0 +1,21 @@ +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case "+": + return add(a, b); + case "-": + return subtract(a, b); + case "*": + return multiply(a, b); + case "/": + return divide(a, b); + default: + return "Invalid operator"; + } +}; + +export default operate; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.3.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.3.txt index 93843d169a8..6f99874b227 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.3.txt @@ -1 +1,42 @@ -const add = (a, b) => a + b \ No newline at end of file +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return 'Invalid operator'; + } +}; + +const display = document.querySelector('.display'); +const buttons = document.querySelectorAll('button'); + +let currentInput = ''; +let previousInput = ''; +let operation = null; +let resetScreen = false; + +buttons.forEach(button => { + button.addEventListener('click', () => { + const buttonValue = button.textContent; + + if (button.classList.contains('number')) { + if (resetScreen) { + currentInput = ''; + resetScreen = false; + } + currentInput += buttonValue; + display.textContent = currentInput; + } else if (button.classList.contains('operator')) { + if (operation !== null) { + currentInput = operate \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.4.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.4.txt new file mode 100644 index 00000000000..e5740784897 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.4.txt @@ -0,0 +1,21 @@ +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return 'Invalid operator'; + } +}; + +export default operate; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.5.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.5.txt index 872b8e71ef4..c0f862114d5 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.5.txt @@ -1 +1,17 @@ -const add = (a, b) => a + b; \ No newline at end of file +const add = (a, b) => a + b; +const generateGreeting = (name = 'Anonymous') => `Hello ${name}!`; + +test('should add two numbers', () => { + const result = add(3, 4); + expect(result).toBe(7); +}); + +test('should generate greeting from name', () => { + const result = generateGreeting('Mike'); + expect(result).toBe('Hello Mike!'); +}); + +test('should generate greeting for no name', () => { + const result = generateGreeting(); + expect(result).toBe('Hello Anonymous!'); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.6.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.6.txt index 50286ab9a8f..d3f191086e1 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.6.txt @@ -1,3 +1,18 @@ -const add = (a, b) => { - return a + b; -} \ No newline at end of file +const add = (a, b) => a + b; +const generateGreeting = (name = 'Anonymous') => `Hello ${name}!`; + +test('should add two numbers', () => { + const result = add(3, 4); + + expect(result).toBe(7); +}); + +test('should generate greeting from name', () => { + const result = generateGreeting('Mike'); + expect(result).toBe('Hello Mike!'); +}); + +test('should generate greeting for no name', () => { + const result = generateGreeting(); + expect(result).toBe('Hello Anonymous!'); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.7.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.7.txt index 72972893208..a9587c35d45 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.7.txt @@ -1,3 +1,21 @@ -const add = (a, b) => { - return a + b; -} \ No newline at end of file +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return null; + } +}; + +export default operate; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.8.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.8.txt index 1e7a312b7ff..ea499c30493 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.8.txt @@ -1,3 +1,41 @@ -const add = (a, b) { - return a + b; -} \ No newline at end of file +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return 'Invalid operator'; + } +}; + +const display = document.querySelector('.display'); +const buttons = document.querySelectorAll('.button'); + +let firstNumber = ''; +let secondNumber = ''; +let currentOperator = ''; +let result = ''; + +buttons.forEach(button => { + button.addEventListener('click', () => { + const value = button.textContent; + + if (value === 'C') { + firstNumber = ''; + secondNumber = ''; + currentOperator = ''; + result = ''; + display.textContent = '0'; + } else if (value === '=') { + if (firstNumber && secondNumber && currentOperator) { + result = operate(currentOperator, parseFloat(firstNumber), parseFloat(second \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.9.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.9.txt index c51980cd836..d2b6b321852 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.approved.9.txt @@ -1,3 +1,42 @@ -const add = (a, b) : number => { - return a + b; -} \ No newline at end of file +const add = (a, b) => a + b; +const subtract = (a, b) => a - b; +const multiply = (a, b) => a * b; +const divide = (a, b) => a / b; + +const operate = (operator, a, b) => { + switch (operator) { + case '+': + return add(a, b); + case '-': + return subtract(a, b); + case '*': + return multiply(a, b); + case '/': + return divide(a, b); + default: + return 'Invalid operator'; + } +}; + +const display = document.querySelector('.display'); +const buttons = document.querySelectorAll('.button'); + +let currentInput = ''; +let previousInput = ''; +let currentOperator = null; +let resetDisplay = false; + +buttons.forEach(button => { + button.addEventListener('click', () => { + const value = button.textContent; + + if (button.classList.contains('number')) { + if (resetDisplay) { + currentInput = ''; + resetDisplay = false; + } + currentInput += value; + display.textContent = currentInput; + } else if (button.classList.contains('operator')) { + if (currentInput === '') return; + if (previousInput \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.rejected.2.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.rejected.2.txt deleted file mode 100644 index da8bbc67f4c..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.rejected.2.txt +++ /dev/null @@ -1 +0,0 @@ -const add = (a, b); <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.rejected.4.txt b/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.rejected.4.txt deleted file mode 100644 index 5fc76fb19c0..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/arrow-function.rejected.4.txt +++ /dev/null @@ -1 +0,0 @@ -const add = (a, b) => a + b; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.1.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.1.txt index 58cbe1f5383..73cdb787ff7 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.1.txt @@ -1,3 +1,25 @@ function calculateSum(a, b) { - <<>> -} \ No newline at end of file + return a + b; + } + + function calculateDifference(a, b) { + return a - b; + } + + function calculateProduct(a, b) { + return a * b; + } + + function calculateQuotient(a, b) { + if (b === 0) { + throw new Error("Cannot divide by zero"); + } + return a / b; + } + + module.exports = { + calculateSum, + calculateDifference, + calculateProduct, + calculateQuotient + }; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.10.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.10.txt new file mode 100644 index 00000000000..ca9ef18da67 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.10.txt @@ -0,0 +1,25 @@ +function calculateSum(a, b) { + return a + b; +} + +function calculateDifference(a, b) { + return a - b; +} + +function calculateProduct(a, b) { + return a * b; +} + +function calculateQuotient(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a / b; +} + +function calculateRemainder(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a % b; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.11.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.11.txt new file mode 100644 index 00000000000..108a412f21c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.11.txt @@ -0,0 +1,9 @@ +function calculateSum(a, b) { + return a + b; + } + + // Example usage: + const num1 = 5; + const num2 = 7; + const result = calculateSum(num1, num2); + console.log(`The sum of ${num1} and ${num2} is: ${result}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.2.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.2.txt new file mode 100644 index 00000000000..21515740969 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.2.txt @@ -0,0 +1,18 @@ +function calculateSum(a, b) { + return a + b; +} + +function calculateDifference(a, b) { + return a - b; +} + +function calculateProduct(a, b) { + return a * b; +} + +function calculateQuotient(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a / b; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.4.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.4.txt deleted file mode 100644 index df17fd1d582..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.4.txt +++ /dev/null @@ -1 +0,0 @@ -function calculateSum(a, b) {<<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.5.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.5.txt deleted file mode 100644 index 57310024307..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.5.txt +++ /dev/null @@ -1 +0,0 @@ -function calculateSum(a, b) { \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.6.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.6.txt index 70d2f10f70b..5a2f3bccfe2 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.6.txt @@ -1,3 +1,25 @@ function calculateSum(a, b) { - return a + b; -} \ No newline at end of file + return a + b; +} + +function calculateDifference(a, b) { + return a - b; +} + +function calculateProduct(a, b) { + return a * b; +} + +function calculateQuotient(a, b) { + if (b === 0) { + throw new Error("Cannot divide by zero"); + } + return a / b; +} + +module.exports = { + calculateSum, + calculateDifference, + calculateProduct, + calculateQuotient +}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.7.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.7.txt deleted file mode 100644 index 9d40da572a7..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.7.txt +++ /dev/null @@ -1,3 +0,0 @@ -function calculateSum(a, b) { - -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.8.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.8.txt index 2ec92cf86db..d0957167c99 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.approved.8.txt @@ -1,3 +1,25 @@ function calculateSum(a, b) { - return a + b; -} \ No newline at end of file + return a + b; + } + + function calculateDifference(a, b) { + return a - b; + } + + function calculateProduct(a, b) { + return a * b; + } + + function calculateQuotient(a, b) { + if (b === 0) { + throw new Error("Cannot divide by zero"); + } + return a / b; + } + + module.exports = { + calculateSum, + calculateDifference, + calculateProduct, + calculateQuotient, + }; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.1.txt index 5933219e8eb..53fa4b85281 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.1.txt @@ -1,3 +1,13 @@ -def calculate_sum(a, b): - return a + b - <<>> \ No newline at end of file +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number: " +a = gets.chomp.to_i + +puts "Enter the second number: " +b = gets.chomp.to_i + +result = calculate_sum(a, b) +puts "The sum of #{a} and #{b} is #{result}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.10.txt index d9f39011dcf..5e8d21e7137 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.10.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.10.txt @@ -1,2 +1,15 @@ def calculate_sum(a, b) - a + b \ No newline at end of file + return a + b +end + +def calculate_difference(a, b) + return a - b +end + +def calculate_product(a, b) + return a * b +end + +def calculate_quotient(a, b) + return a / b +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.11.txt new file mode 100644 index 00000000000..6fe3b3ddd5b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.11.txt @@ -0,0 +1,13 @@ +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number: " +first_number = gets.chomp.to_i + +puts "Enter the second number: " +second_number = gets.chomp.to_i + +result = calculate_sum(first_number, second_number) +puts "The sum of #{first_number} and #{second_number} is #{result}." \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.12.txt new file mode 100644 index 00000000000..55100f29b77 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.12.txt @@ -0,0 +1,19 @@ +def calculate_sum(a, b) + a + b +end + +def calculate_difference(a, b) + a - b +end + +def calculate_product(a, b) + a * b +end + +def calculate_quotient(a, b) + a / b +end + +def calculate_remainder(a, b) + a % b +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.14.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.14.txt new file mode 100644 index 00000000000..5e774af4460 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.14.txt @@ -0,0 +1,14 @@ +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number: " +a = gets.chomp.to_i + +puts "Enter the second number: " +b = gets.chomp.to_i + +result = calculate_sum(a, b) + +puts "The sum of #{a} and #{b} is #{result}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.2.txt new file mode 100644 index 00000000000..3b36c355755 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.2.txt @@ -0,0 +1,15 @@ +def calculate_sum(a, b) + a + b +end + +def calculate_difference(a, b) + a - b +end + +def calculate_product(a, b) + a * b +end + +def calculate_quotient(a, b) + a / b +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.3.txt index fd4117bfc3c..4f54fc7083f 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.3.txt @@ -1,2 +1,12 @@ def calculate_sum(a, b) - return a + b \ No newline at end of file + sum = a + b + return sum +end + +puts "Enter the first number" +a = gets.chomp.to_i + +puts "Enter the second number" +b = gets.chomp.to_i + +puts "The sum of #{a} and #{b} is #{calculate_sum(a, b)}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.4.txt new file mode 100644 index 00000000000..4381c71706d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.4.txt @@ -0,0 +1,11 @@ +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number" +a = gets.chomp.to_i +puts "Enter the second number" +b = gets.chomp.to_i + +puts "The sum of #{a} and #{b} is #{calculate_sum(a, b)}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.5.txt index a72c3f2e7df..24f4b3b822c 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.5.txt @@ -1,2 +1,13 @@ -def calculate_sum(a, b): - return a + b \ No newline at end of file +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number:" +a = gets.chomp.to_i + +puts "Enter the second number:" +b = gets.chomp.to_i + +result = calculate_sum(a, b) +puts "The sum of #{a} and #{b} is #{result}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.6.txt new file mode 100644 index 00000000000..66170877d1b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.6.txt @@ -0,0 +1,12 @@ +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number: " +a = gets.chomp.to_i + +puts "Enter the second number: " +b = gets.chomp.to_i + +puts "The sum of #{a} and #{b} is #{calculate_sum(a, b)}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.7.txt index 9b80c0ea820..3d9ddadbeae 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.7.txt @@ -1,2 +1,24 @@ -def calculate_sum(a, b): - return a + b \ No newline at end of file +def calculate_sum(a, b) + sum = a + b + return sum +end + +def calculate_difference(a, b) + difference = a - b + return difference +end + +def calculate_product(a, b) + product = a * b + return product +end + +def calculate_quotient(a, b) + quotient = a / b + return quotient +end + +def calculate_remainder(a, b) + remainder = a % b + return remainder +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.8.txt new file mode 100644 index 00000000000..92768abb577 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.8.txt @@ -0,0 +1,13 @@ +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts "Enter the first number:" +a = gets.chomp.to_i + +puts "Enter the second number:" +b = gets.chomp.to_i + +result = calculate_sum(a, b) +puts "The sum of #{a} and #{b} is #{result}." \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.9.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.9.txt index 3117dcf9175..abee4aae170 100644 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.approved.9.txt @@ -1,2 +1,11 @@ def calculate_sum(a, b) - return a + b \ No newline at end of file + sum = a + b + return sum +end + +puts "Enter the first number: " +a = gets.chomp.to_i +puts "Enter the second number: " +b = gets.chomp.to_i + +puts "The sum of #{a} and #{b} is #{calculate_sum(a, b)}" \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.13.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.13.txt new file mode 100644 index 00000000000..13e92379033 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.13.txt @@ -0,0 +1,13 @@ +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts calculate_sum(1, 2) + +def calculate_sum(a, b) + sum = a + b + return sum +end + +puts calculate_sum(1, 2) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.2.txt deleted file mode 100644 index 99c1281378e..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.2.txt +++ /dev/null @@ -1,2 +0,0 @@ -def calculate_sum(a, b) - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.4.txt deleted file mode 100644 index a6753f5007f..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.4.txt +++ /dev/null @@ -1,2 +0,0 @@ -def calculate_sum(a, b): - <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.6.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.6.txt deleted file mode 100644 index 1390b47ec15..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.6.txt +++ /dev/null @@ -1,2 +0,0 @@ -def calculate_sum(a, b): - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.8.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.8.txt deleted file mode 100644 index fc83812ad80..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rb.rejected.8.txt +++ /dev/null @@ -1,3 +0,0 @@ -def calculate_sum(a, b) - : - return a + b \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.2.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.2.txt deleted file mode 100644 index 4e83e75d0c9..00000000000 --- a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.2.txt +++ /dev/null @@ -1 +0,0 @@ -function calculateSum(a, b) <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.4.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.4.txt new file mode 100644 index 00000000000..e061249c400 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.4.txt @@ -0,0 +1,50 @@ +function calculateSum(a, b) { + return a + b; + } + + function calculateDifference(a, b) { + return a - b; + } + + function calculateProduct(a, b) { + return a * b; + } + + function calculateQuotient(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a / b; + } + + function calculateRemainder(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a % b; + } + + function calculatePower(a, b) { + return Math.pow(a, b); + } + + function calculateSquareRoot(a) { + if (a < 0) { + return "Cannot calculate square root of a negative number"; + } + return Math.sqrt(a); + } + + function calculateAbsoluteValue(a) { + return Math.abs(a); + } + + function calculateFactorial(a) { + if (a < 0) { + return "Cannot calculate factorial of a negative number"; + } + if (a === 0 || a === 1) { + return 1; + } + let result = 1; + for (let i \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.5.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.5.txt new file mode 100644 index 00000000000..e8b15a12053 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.5.txt @@ -0,0 +1,50 @@ +function calculateSum(a, b) { + return a + b; + } + + function calculateDifference(a, b) { + return a - b; + } + + function calculateProduct(a, b) { + return a * b; + } + + function calculateQuotient(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a / b; + } + + function calculateRemainder(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a % b; + } + + function calculatePower(a, b) { + return Math.pow(a, b); + } + + function calculateSquareRoot(a) { + if (a < 0) { + return "Cannot calculate square root of a negative number"; + } + return Math.sqrt(a); + } + + function calculateAbsoluteValue(a) { + return Math.abs(a); + } + + function calculateFactorial(a) { + if (a < 0) { + return "Cannot calculate factorial of a negative number"; + } + let result = 1; + for (let i = 2; i <= a; i++) { + result *= i; + } + return result \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.7.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.7.txt new file mode 100644 index 00000000000..f4d405d9d7f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.7.txt @@ -0,0 +1,51 @@ +function calculateSum(a, b) { + return a + b; + } + + function calculateDifference(a, b) { + return a - b; + } + + function calculateProduct(a, b) { + return a * b; + } + + function calculateQuotient(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a / b; + } + + function calculateRemainder(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a % b; + } + + function calculatePower(a, b) { + return Math.pow(a, b); + } + + function calculateSquareRoot(a) { + if (a < 0) { + return "Cannot calculate square root of a negative number"; + } + return Math.sqrt(a); + } + + function calculateAbsoluteValue(a) { + return Math.abs(a); + } + + function calculateRandomNumber() { + return Math.random(); + } + + function calculateFactorial(a) { + if (a < 0) { + return "Cannot calculate factorial of a negative number"; + } + if (a === 0 || a === 1) { + return 1; diff --git a/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.9.txt b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.9.txt new file mode 100644 index 00000000000..316d3de0398 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/function-declaration/function-body.rejected.9.txt @@ -0,0 +1,51 @@ +function calculateSum(a, b) { + return a + b; + } + + function calculateDifference(a, b) { + return a - b; + } + + function calculateProduct(a, b) { + return a * b; + } + + function calculateQuotient(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a / b; + } + + function calculateRemainder(a, b) { + if (b === 0) { + return "Cannot divide by zero"; + } + return a % b; + } + + function calculatePower(a, b) { + return Math.pow(a, b); + } + + function calculateSquareRoot(a) { + if (a < 0) { + return "Cannot calculate square root of a negative number"; + } + return Math.sqrt(a); + } + + function calculateAbsoluteValue(a) { + return Math.abs(a); + } + + function calculateRandomNumber() { + return Math.random(); + } + + function calculateFactorial(a) { + if (a < 0) { + return "Cannot calculate factorial of a negative number"; + } + let result = 1; + for (let i = 2; i <= a \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.3.txt b/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.3.txt deleted file mode 100644 index e8d85d5e801..00000000000 --- a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.3.txt +++ /dev/null @@ -1 +0,0 @@ -import { useState } from 'react' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.4.txt b/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.4.txt deleted file mode 100644 index 2e419330bc0..00000000000 --- a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.4.txt +++ /dev/null @@ -1 +0,0 @@ -import React <<>> from 'react' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.5.txt b/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.5.txt deleted file mode 100644 index 50a0363fbf6..00000000000 --- a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.approved.5.txt +++ /dev/null @@ -1 +0,0 @@ -import useState from 'react' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.rejected.2.txt b/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.rejected.2.txt deleted file mode 100644 index e24b0473c90..00000000000 --- a/src/test-llm-autocompletion/approvals/import-statement/import-curly-brace.rejected.2.txt +++ /dev/null @@ -1 +0,0 @@ -import <<>> from 'react' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/conditional-expression.approved.2.txt b/src/test-llm-autocompletion/approvals/inline-completion/conditional-expression.approved.2.txt deleted file mode 100644 index 2c6f6483c4a..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/conditional-expression.approved.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -function isValid(value) { - return value !== null && value !== undefined && value !== ''; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.1.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.1.txt index 2b177589d47..80ef0511fdf 100644 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.1.txt @@ -1,3 +1,3 @@ -function greet(name: string, greeting: string) { - console.log(`${greeting} ${name}!`); +function greet(name, callback) { + console.log(`Hello ${name}!`); } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.10.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.10.txt deleted file mode 100644 index 2e3579c05ba..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.10.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name, greeting = "Hello") { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.11.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.11.txt deleted file mode 100644 index 5e4937e4925..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.11.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name, greeting = "Welcome") { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.3.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.3.txt deleted file mode 100644 index ac513f36acc..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.3.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name: string, <<>>) { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.5.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.5.txt deleted file mode 100644 index 91776aaa447..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.5.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name) { { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.7.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.7.txt deleted file mode 100644 index f94aa426520..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.7.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name: string, ) { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.9.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.9.txt deleted file mode 100644 index 28ee9ae5a9a..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.approved.9.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name, age: string) { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.2.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.2.txt deleted file mode 100644 index 7cef9e56dc7..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name: string, age: number) { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.4.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.4.txt deleted file mode 100644 index e7230963e7f..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.4.txt +++ /dev/null @@ -1,4 +0,0 @@ -function greet(name, greeting = "World") { - console.log(`Hello ${name}!`); { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.6.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.6.txt deleted file mode 100644 index 337dc61c98a..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.6.txt +++ /dev/null @@ -1,4 +0,0 @@ -function greet(name) { - console.log(`Hello ${name}!`); { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.8.txt b/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.8.txt deleted file mode 100644 index 5f1aeaa5bd0..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/function-parameter.rejected.8.txt +++ /dev/null @@ -1,3 +0,0 @@ -function greet(name, name: string) { - console.log(`Hello ${name}!`); -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/property-access.approved.3.txt b/src/test-llm-autocompletion/approvals/inline-completion/property-access.approved.3.txt deleted file mode 100644 index a241b362b4f..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/property-access.approved.3.txt +++ /dev/null @@ -1,2 +0,0 @@ -const user = { name: 'John', age: 30 }; -console.log(user.name);; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/property-access.approved.4.txt b/src/test-llm-autocompletion/approvals/inline-completion/property-access.approved.4.txt deleted file mode 100644 index 06bde9f8e2c..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/property-access.approved.4.txt +++ /dev/null @@ -1,2 +0,0 @@ -const user = { name: 'John', age: 30 }; -console.log(user.name, age); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/property-access.rejected.2.txt b/src/test-llm-autocompletion/approvals/inline-completion/property-access.rejected.2.txt deleted file mode 100644 index 615963eade2..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/property-access.rejected.2.txt +++ /dev/null @@ -1,2 +0,0 @@ -const user = { name: 'John', age: 30 }; -console.log(user.name)); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.2.txt b/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.2.txt index e716b6f30c0..5464b7dfb42 100644 --- a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.2.txt +++ b/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.2.txt @@ -1,2 +1,2 @@ -const total = items.reduce((acc, curr) => acc + curr, 0); +const total = items.reduce((sum, value) => sum + value, 0); const items = [1, 2, 3, 4, 5]; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.3.txt b/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.3.txt index a18c0a6024f..08b61ff0bd4 100644 --- a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.3.txt @@ -1,2 +1,2 @@ -const total = items.reduce((acc, curr) => acc + curr, 0);; +const total = (acc, item) => acc + item; const items = [1, 2, 3, 4, 5]; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.4.txt b/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.4.txt deleted file mode 100644 index 9a2e7fa500d..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.4.txt +++ /dev/null @@ -1,2 +0,0 @@ -const total = items.reduce((sum, item) => sum + item, 0);; -const items = [1, 2, 3, 4, 5]; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.5.txt b/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.5.txt deleted file mode 100644 index bd1cb800d24..00000000000 --- a/src/test-llm-autocompletion/approvals/inline-completion/variable-assignment-value.approved.5.txt +++ /dev/null @@ -1,2 +0,0 @@ -const total = items.reduce((acc, item) => acc + item, 0); -const items = [1, 2, 3, 4, 5]; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.approved.3.txt b/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.approved.3.txt deleted file mode 100644 index 2e722d976a4..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.approved.3.txt +++ /dev/null @@ -1,146 +0,0 @@ - -/* README - -# Gilded Rose - -This is the Gilded Rose kata in TypeScript. - -## Getting started - -Install dependencies - -```sh -npm install -``` - -## Run the unit tests from the Command-Line - -There are two unit test frameworks to choose from, Jest and Mocha. - -```sh -npm run test:jest -``` - -To run all tests in watch mode - -```sh -npm run test:jest:watch -``` - -Mocha - -```sh -npm run test:mocha -``` - - -## Run the TextTest fixture from the Command-Line - -_You may need to install `ts-node`_ - -```sh -npx ts-node test/golden-master-text-test.ts -``` - -Or with number of days as args: -```sh -npx ts-node test/golden-master-text-test.ts 10 -``` - -You should make sure the command shown above works when you execute it in a terminal before trying to use TextTest (see below). - - -## Run the TextTest approval test that comes with this project - -There are instructions in the [TextTest Readme](../texttests/README.md) for setting up TextTest. You will need to specify the Python executable and interpreter in [config.gr](../texttests/config.gr). Uncomment these lines: - - executable:${TEXTTEST_HOME}/python/texttest_fixture.py - interpreter:python - - -*/ - -export class Item { - name: string - sellIn: number - quality: number - - constructor(name, sellIn, quality) { - this.name = name - this.sellIn = sellIn - this.quality = quality - } -} - -export class GildedRose { - items: Array - - constructor(items = [] as Array) { - this.items = items - } - - updateQuality() { - for (let i = 0; i < this.items.length; i++) { - if ( - this.items[i].name != "Aged Brie" && - this.items[i].name != "Backstage passes to a TAFKAL80ETC concert" - ) { - if (this.items[i].quality > 0) { - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].quality = this.items[i].quality - 1 - } - } - } else { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - if (this.items[i].name == "Backstage passes to a TAFKAL80ETC concert") { - if (this.items[i].sellIn < 11) { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - if (this.items[i].sellIn < 6) { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - } - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].sellIn = this.items[i].sellIn - 1 - } - if (this.items[i].sellIn < 0) { - if (this.items[i].name != "Aged Brie") { - if (this.items[i].name != "Backstage passes to a TAFKAL80ETC concert") { - if (this.items[i].quality > 0) { - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].quality = this.items[i].quality - 1 - } - } - } else { - this.items[i].quality = this.items[i].quality - this.items[i].quality - } - } else { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - } - } - - return this.items - } -} -) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - - return this.items - } -} diff --git a/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.approved.4.txt b/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.approved.4.txt deleted file mode 100644 index 64401d88ffe..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.approved.4.txt +++ /dev/null @@ -1,137 +0,0 @@ - -/* README - -# Gilded Rose - -This is the Gilded Rose kata in TypeScript. - -## Getting started - -Install dependencies - -```sh -npm install -``` - -## Run the unit tests from the Command-Line - -There are two unit test frameworks to choose from, Jest and Mocha. - -```sh -npm run test:jest -``` - -To run all tests in watch mode - -```sh -npm run test:jest:watch -``` - -Mocha - -```sh -npm run test:mocha -``` - - -## Run the TextTest fixture from the Command-Line - -_You may need to install `ts-node`_ - -```sh -npx ts-node test/golden-master-text-test.ts -``` - -Or with number of days as args: -```sh -npx ts-node test/golden-master-text-test.ts 10 -``` - -You should make sure the command shown above works when you execute it in a terminal before trying to use TextTest (see below). - - -## Run the TextTest approval test that comes with this project - -There are instructions in the [TextTest Readme](../texttests/README.md) for setting up TextTest. You will need to specify the Python executable and interpreter in [config.gr](../texttests/config.gr). Uncomment these lines: - - executable:${TEXTTEST_HOME}/python/texttest_fixture.py - interpreter:python - - -*/ - -export class Item { - name: string - sellIn: number - quality: number - - constructor(name, sellIn, quality) { - this.name = name - this.sellIn = sellIn - this.quality = quality - } -} - -export class GildedRose { - items: Array - - constructor(items = [] as Array) { - this.items = items - } - - updateQuality() { - for (let i = 0; i < this.items.length; i++) { - if ( - this.items[i].name != "Aged Brie" && - this.items[i].name != "Backstage passes to a TAFKAL80ETC concert" - ) { - if (this.items[i].quality > 0) { - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].quality = this.items[i].quality - 1 - } - } - } else { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - if (this.items[i].name == "Backstage passes to a TAFKAL80ETC concert") { - if (this.items[i].sellIn < 11) { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - if (this.items[i].sellIn < 6) { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - } - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].sellIn = this.items[i].sellIn - 1 - } - if (this.items[i].sellIn < 0) { - if (this.items[i].name != "Aged Brie") { - if (this.items[i].name != "Backstage passes to a TAFKAL80ETC concert") { - if (this.items[i].quality > 0) { - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].quality = this.items[i].quality - 1 - } - } - } else { - this.items[i].quality = this.items[i].quality - this.items[i].quality - } - } else { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - }) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - - return this.items - } -} diff --git a/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.rejected.2.txt b/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.rejected.2.txt deleted file mode 100644 index 12c167dde5e..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/gilded-rose.ts.rejected.2.txt +++ /dev/null @@ -1,134 +0,0 @@ - -/* README - -# Gilded Rose - -This is the Gilded Rose kata in TypeScript. - -## Getting started - -Install dependencies - -```sh -npm install -``` - -## Run the unit tests from the Command-Line - -There are two unit test frameworks to choose from, Jest and Mocha. - -```sh -npm run test:jest -``` - -To run all tests in watch mode - -```sh -npm run test:jest:watch -``` - -Mocha - -```sh -npm run test:mocha -``` - - -## Run the TextTest fixture from the Command-Line - -_You may need to install `ts-node`_ - -```sh -npx ts-node test/golden-master-text-test.ts -``` - -Or with number of days as args: -```sh -npx ts-node test/golden-master-text-test.ts 10 -``` - -You should make sure the command shown above works when you execute it in a terminal before trying to use TextTest (see below). - - -## Run the TextTest approval test that comes with this project - -There are instructions in the [TextTest Readme](../texttests/README.md) for setting up TextTest. You will need to specify the Python executable and interpreter in [config.gr](../texttests/config.gr). Uncomment these lines: - - executable:${TEXTTEST_HOME}/python/texttest_fixture.py - interpreter:python - - -*/ - -export class Item { - name: string - sellIn: number - quality: number - - constructor(name, sellIn, quality) { - this.name = name - this.sellIn = sellIn - this.quality = quality - } -} - -export class GildedRose { - items: Array - - constructor(items = [] as Array) { - this.items = items - } - - updateQuality() { - for (let i = 0; i < this.items.length; i++) { - if ( - this.items[i].name != "Aged Brie" && - this.items[i].name != "Backstage passes to a TAFKAL80ETC concert" - ) { - if (this.items[i].quality > 0) { - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].quality = this.items[i].quality - 1 - } - } - } else { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - if (this.items[i].name == "Backstage passes to a TAFKAL80ETC concert") { - if (this.items[i].sellIn < 11) { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - if (this.items[i].sellIn < 6) { - if (this.items[i].quality < 50) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - } - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].sellIn = this.items[i].sellIn - 1 - } - if (this.items[i].sellIn < 0) { - if (this.items[i].name != "Aged Brie") { - if (this.items[i].name != "Backstage passes to a TAFKAL80ETC concert") { - if (this.items[i].quality > 0) { - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].quality = this.items[i].quality - 1 - } - } - } else { - this.items[i].quality = this.items[i].quality - this.items[i].quality - } - } else { - if (this.items[i].quality < <<>>) { - this.items[i].quality = this.items[i].quality + 1 - } - } - } - } - - return this.items - } -} diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.11.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.11.txt deleted file mode 100644 index 96d7aef7244..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.11.txt +++ /dev/null @@ -1,763 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - - - } - - window.addEventListener('resize', sizeBoardToViewport); - - // --- Function Wrappers for Layout - const _oldRenderBoard = renderBoard; - renderBoard = function(){ - _oldRenderBoard(); - sizeBoardToViewport(); - }; - - const _oldNewGame = newGame; - newGame = function(){ - _oldNewGame(); - setTimeout(sizeBoardToViewport, 15); // Allow DOM to update - }; - - // --- Boot - newGame(); - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.12.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.12.txt deleted file mode 100644 index 143bc92e676..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.12.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.3.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.3.txt deleted file mode 100644 index c95ff057e2f..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.3.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.5.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.5.txt deleted file mode 100644 index 78cdb6e077d..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.5.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.7.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.7.txt deleted file mode 100644 index 7a003ee561e..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.7.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.9.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.9.txt deleted file mode 100644 index d13cdd47492..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.approved.9.txt +++ /dev/null @@ -1,741 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.10.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.10.txt deleted file mode 100644 index 71ab0cc7966..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.10.txt +++ /dev/null @@ -1,741 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.2.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.2.txt deleted file mode 100644 index af9418ee9dc..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.2.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.4.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.4.txt deleted file mode 100644 index ac9c41cba3d..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.4.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.6.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.6.txt deleted file mode 100644 index 0f703939386..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.6.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.8.txt b/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.8.txt deleted file mode 100644 index 5c04bcb9dfd..00000000000 --- a/src/test-llm-autocompletion/approvals/larger-examples/sudoku.html.rejected.8.txt +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - Sudoku++ - - - -
- - -
-
-
-
Loading…
- -
- -
-
- - - - - - - \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/new-line/after-for-loop.approved.2.txt b/src/test-llm-autocompletion/approvals/new-line/after-for-loop.approved.2.txt deleted file mode 100644 index c16844c6eef..00000000000 --- a/src/test-llm-autocompletion/approvals/new-line/after-for-loop.approved.2.txt +++ /dev/null @@ -1,8 +0,0 @@ -function sumArray(arr) { - let sum = 0; - for (let i = 0; i < arr.length; i++) { - sum += arr[i]; -<<>> - } - return sum; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/new-line/after-for-loop.approved.3.txt b/src/test-llm-autocompletion/approvals/new-line/after-for-loop.approved.3.txt deleted file mode 100644 index cde3f26a297..00000000000 --- a/src/test-llm-autocompletion/approvals/new-line/after-for-loop.approved.3.txt +++ /dev/null @@ -1,8 +0,0 @@ -function sumArray(arr) { - let sum = 0; - for (let i = 0; i < arr.length; i++) { - sum += arr[i]; - - } - return sum; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/new-line/after-if-statement.approved.2.txt b/src/test-llm-autocompletion/approvals/new-line/after-if-statement.approved.2.txt deleted file mode 100644 index 035c90f5153..00000000000 --- a/src/test-llm-autocompletion/approvals/new-line/after-if-statement.approved.2.txt +++ /dev/null @@ -1,7 +0,0 @@ -function checkValue(value) { - if (value > 0) { - return true; -<<>> - } - return false; -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/new-line/before-closing-brace.approved.2.txt b/src/test-llm-autocompletion/approvals/new-line/before-closing-brace.approved.2.txt deleted file mode 100644 index ef008f9c363..00000000000 --- a/src/test-llm-autocompletion/approvals/new-line/before-closing-brace.approved.2.txt +++ /dev/null @@ -1,5 +0,0 @@ -function calculateTotal(items) { - const sum = items.reduce((a, b) => a + b, 0); - return sum; -<<>> -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/new-line/before-closing-brace.approved.3.txt b/src/test-llm-autocompletion/approvals/new-line/before-closing-brace.approved.3.txt deleted file mode 100644 index 280f30577dd..00000000000 --- a/src/test-llm-autocompletion/approvals/new-line/before-closing-brace.approved.3.txt +++ /dev/null @@ -1,5 +0,0 @@ -function calculateTotal(items) { - const sum = items.reduce((a, b) => a + b, 0); - return sum; -} -} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.1.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.1.txt index 4060858ba24..c44456135ed 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.1.txt @@ -1 +1,11 @@ -const numbers = [] \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +for (let i = 0; i < numbers.length; i++) { + if (numbers[i] % 2 === 0) { + console.log(numbers[i]); + } +} + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.10.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.10.txt index 32d83152a0a..3d1e51fcffb 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.10.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.10.txt @@ -1 +1,15 @@ -const numbers = [1, 2, 3] \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const answer = numbers.map(function (number) { + return number * 3; +}); + +console.log(answer); + +// const tripledNumbers = []; + +// for (let i = 0; i < numbers.length; i++) { +// tripledNumbers.push(numbers[i] * 3); +// } + +// console.log(tripledNumbers); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.11.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.11.txt new file mode 100644 index 00000000000..df93feb3ca8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.11.txt @@ -0,0 +1,15 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +const users = [ + { name: "John", age: 25 }, + { name: "Jane", age: 30 }, + { name: "Bob", age: 20 }, +]; + +const adults = users.filter((user) => user.age >= 18); + +console.log(adults); // [{ name: 'John', age: 25 }, { name: 'Jane', age: 30 }] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.12.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.12.txt new file mode 100644 index 00000000000..89fe2d03dc7 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.12.txt @@ -0,0 +1,13 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// 1. The filter() method is called on the numbers array. +// 2. The filter() method takes a callback function as an argument. +// 3. The callback function is called for each element in the array. +// 4. The callback function returns true if the element is even, and false otherwise. +// 5. The filter() method creates a new array with all elements that pass the test implemented by the callback function. +// 6. The new array is assigned to the evenNumbers variable. +// 7. The evenNumbers variable is logged to the console. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.13.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.13.txt new file mode 100644 index 00000000000..87b57bedb46 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.13.txt @@ -0,0 +1,11 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// 2. Filter out all the odd numbers from the array. + +const oddNumbers = numbers.filter((number) => number % 2 !== 0); + +console.log(oddNumbers); // [1, 3, 5, 7, 9] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.14.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.14.txt new file mode 100644 index 00000000000..c476a868aef --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.14.txt @@ -0,0 +1,20 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const sum = numbers.reduce((accumulator, currentValue) => { + return accumulator + currentValue; +}, 0); + +console.log(sum); // 55 + +const words = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple']; + +const wordCount = words.reduce((accumulator, currentValue) => { + if (accumulator[currentValue]) { + accumulator[currentValue]++; + } else { + accumulator[currentValue] = 1; + } + return accumulator; +}, {}); + +console.log(wordCount); // { apple: 3, banana: 2, orange: 1 } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.15.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.15.txt new file mode 100644 index 00000000000..06e36ce3aee --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.15.txt @@ -0,0 +1,8 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// The filter() method creates a new array with all elements that pass the test implemented by the provided function. +// In this example, the filter() method is used to create a new array called evenNumbers that contains only the even numbers from the original array called numbers. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.16.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.16.txt new file mode 100644 index 00000000000..cd973f2a1f4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.16.txt @@ -0,0 +1,11 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const sum = numbers.reduce((acc, curr) => acc + curr, 0); + +console.log(sum); // 55 + +// Explanation: +// acc is the accumulator, which starts at 0 because we set the initial value of the accumulator to 0 in the second argument of reduce(). +// curr is the current element being processed in the array. +// In each iteration, we add the current element to the accumulator, and the next iteration starts with this updated accumulator value. +// After processing all elements, the accumulator contains the sum of all elements in the array. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.17.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.17.txt new file mode 100644 index 00000000000..6d3c0e26a6c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.17.txt @@ -0,0 +1,19 @@ +const numbers = [1, 2, 3, 4, 5]; + +// for (let i = 0; i < numbers.length; i++) { +// console.log(numbers[i]); +// } + +numbers.forEach((number) => { + console.log(number); +}); + +const users = [ + { name: "John", age: 30 }, + { name: "Jane", age: 25 }, + { name: "Jim", age: 35 }, +]; + +users.forEach((user) => { + console.log(user.name); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.18.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.18.txt new file mode 100644 index 00000000000..6b5558f276b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.18.txt @@ -0,0 +1,13 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +for (let i = 0; i < numbers.length; i++) { + if (numbers[i] % 2 === 0) { + console.log(numbers[i]); + } +} + +for (let i = 0; i < numbers.length; i++) { + if (numbers[i] % 2 !== 0) { + console.log(numbers[i]); + } +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.19.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.19.txt new file mode 100644 index 00000000000..58a8c847c61 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.19.txt @@ -0,0 +1,11 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const answer = numbers.map((number) => { + if (number % 2 === 0) { + return "even"; + } else { + return "odd"; + } +}); + +console.log(answer); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.2.txt index e7e1ed00f22..62cd98ef531 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.2.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.2.txt @@ -1 +1,15 @@ -const numbers = []; \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +const users = [ + { name: "John", age: 25 }, + { name: "Jane", age: 30 }, + { name: "Bob", age: 20 }, +]; + +const adults = users.filter((user) => user.age >= 21); + +console.log(adults); // [{ name: "John", age: 25 }, { name: "Jane", age: 30 }] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.21.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.21.txt new file mode 100644 index 00000000000..03b154bf58c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.21.txt @@ -0,0 +1,15 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +for (let i = 0; i < numbers.length; i++) { + if (numbers[i] % 2 === 0) { + console.log(numbers[i]); + } +} + +let i = 0; +while (i < numbers.length) { + if (numbers[i] % 2 === 0) { + console.log(numbers[i]); + } + i++; +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.22.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.22.txt new file mode 100644 index 00000000000..e6a3ad40bf1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.22.txt @@ -0,0 +1,9 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// filter() method is used to create a new array with all elements that pass the test implemented by the provided function. + +// In this example, the filter() method is used to create a new array called evenNumbers that contains only the even numbers from the original numbers array. The callback function passed to filter() checks if a number is even by using the modulus operator (%). If the remainder of the division by 2 is 0, the number is even and is included in the new array. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.3.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.3.txt index ba41c68b890..e1f0d0556b4 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.3.txt @@ -1 +1,8 @@ -const numbers = [<<>> \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// The filter() method creates a new array with all elements that pass the test implemented by the provided function. +// In this case, the test is whether the number is even (i.e., number % 2 === 0). \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.4.txt index c3cca3aa857..686ec312fc8 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.4.txt @@ -1 +1,9 @@ -const numbers = [1, 2, 3]; \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +const oddNumbers = numbers.filter((number) => number % 2 !== 0); + +console.log(oddNumbers); // [1, 3, 5, 7, 9] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.5.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.5.txt index 98f13bd176a..5f08ab6275e 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.5.txt @@ -1 +1,17 @@ -const numbers: number[] = []; \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const sum = numbers.reduce((acc, curr) => { + return acc + curr; +}, 0); + +console.log(sum); + +const max = numbers.reduce((acc, curr) => { + if (curr > acc) { + return curr; + } else { + return acc; + } +}, numbers[0]); + +console.log(max); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.6.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.6.txt index 55933a161e7..846f70cb0bb 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.6.txt @@ -1 +1,9 @@ -const numbers = [<<>>] \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); + +const oddNumbers = numbers.filter((number) => number % 2 !== 0); + +console.log(oddNumbers); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.7.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.7.txt index fe34954250d..e96812a4e6b 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.7.txt @@ -1 +1,13 @@ -const numbers = [1, 2, 3, 4, 5]; \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +// const evenNumbers = numbers.filter(function(number) { +// return number % 2 === 0; +// }); + +// console.log(evenNumbers); // [2, 4, 6, 8, 10] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.8.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.8.txt index d61ddad140d..a1bbbfaab90 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.8.txt @@ -1 +1,25 @@ -const numbers = [ \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +for (let i = 0; i < numbers.length; i++) { + if (numbers[i] % 2 === 0) { + console.log(numbers[i]); + } +} + +const cars = ["BMW", "Volvo", "Saab", "Ford", "Fiat", "Audi"]; + +let text = ""; +for (let i = 0; i < cars.length; i++) { + text += cars[i] + " "; +} +console.log(text); + +const cars2 = ["BMW", "Volvo", "Saab", "Ford"]; +let i = 0; +let text2 = ""; + +while (cars2[i]) { + text2 += cars2[i] + " "; + i++; +} +console.log(text2); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.9.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.9.txt index de853445092..fab12e9e6ec 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.approved.9.txt @@ -1 +1,13 @@ -const numbers = [1, 2, 3, 4, 5] \ No newline at end of file +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +// 1. The filter() method is called on the numbers array. +// 2. The filter() method takes a callback function as an argument. +// 3. The callback function is called for each element in the array. +// 4. The callback function returns true if the element is even, and false otherwise. +// 5. The filter() method returns a new array containing only the elements for which the callback function returned true. +// 6. The new array is assigned to the evenNumbers variable. +// 7. The evenNumbers variable is logged to the console. \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.1.txt index b8db02b1e43..916433ddf02 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.1.txt @@ -1 +1,11 @@ -arr = [1, 2, 3]; \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +sum = 0 + +for i in arr: + sum += i + +print(sum) + +# or + +print(sum(arr)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.10.txt new file mode 100644 index 00000000000..4479129d547 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.10.txt @@ -0,0 +1,23 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] + +def binary_search(arr, target): + left = 0 + right = len(arr) - 1 + + while left <= right: + mid = (left + right) // 2 + if arr[mid] == target: + return mid + elif arr[mid] < target: + left = mid + 1 + else: + right = mid - 1 + return -1 + +target = 10 +result = binary_search(arr, target) +if result != -1: + \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.11.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.11.txt new file mode 100644 index 00000000000..702d8a1fb1a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.11.txt @@ -0,0 +1,26 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def binary_search(arr, target): + left = 0 + right = len(arr) - 1 + + while left <= right: + mid = (left + right) // 2 + if arr[mid] == target: + return mid + elif arr[mid] < target: + left = mid + 1 + else: + right = mid - 1 + + return -1 + +target = 10 +result = binary_search(arr, target) + +if result != -1: + print(f"Element {target} found at index {result}.") +else: + print(f"Element {target} not found in the array.") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.12.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.12.txt new file mode 100644 index 00000000000..edaa7e32510 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.12.txt @@ -0,0 +1,18 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +arr.each { |n| puts n } + +arr.each { |n| puts n if n > 5 } + +odd = arr.select { |n| n.odd? } +puts odd + +arr.push(11) +arr.unshift(0) +puts arr + +arr.pop +arr.push(3) +puts arr + +arr.uniq! +puts arr \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.13.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.13.txt new file mode 100644 index 00000000000..3bad9516e76 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.13.txt @@ -0,0 +1,22 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def binary_search(arr, target): + left = 0 + right = len(arr) - 1 + + while left <= right: + mid = (left + right) // 2 + if arr[mid] == target: + return mid + elif arr[mid] < target: + left = mid + 1 + else: + right = mid - 1 + + return -1 + +target = 7 +result = binary_search(arr, target) +print(f"Element {target} found at index {result}") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.14.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.14.txt new file mode 100644 index 00000000000..811e31e1165 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.14.txt @@ -0,0 +1,14 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def find_missing(arr) + arr.each_with_index do |num, index| + if num != index + 1 + return index + 1 + end + end + return nil +end + +puts find_missing(arr) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.15.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.15.txt new file mode 100644 index 00000000000..cc1823f7550 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.15.txt @@ -0,0 +1,27 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def binary_search(arr, target): + left = 0 + right = len(arr) - 1 + + while left <= right: + mid = (left + right) // 2 + + if arr[mid] == target: + return mid + elif arr[mid] < target: + left = mid + 1 + else: + right = mid - 1 + + return -1 + +target = 7 +result = binary_search(arr, target) + +if result != -1: + print(f"Element {target} found at index {result}.") +else: + print(f"Element {target} not found in the array.") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.16.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.16.txt new file mode 100644 index 00000000000..e11da137861 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.16.txt @@ -0,0 +1,11 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def find_missing(arr): + n = len(arr) + total = (n + 1) * (n + 2) // 2 + sum_of_arr = sum(arr) + return total - sum_of_arr + +print(find_missing(arr)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.17.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.17.txt new file mode 100644 index 00000000000..8f423bc7495 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.17.txt @@ -0,0 +1,14 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |num| + puts num +end + +arr.each { |num| puts num } + +arr = [1, 2, 3, 4, 5] +new_arr = arr.map do |num| + num + 2 +end + +p arr +p new_arr \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.18.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.18.txt new file mode 100644 index 00000000000..afb9e7cd265 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.18.txt @@ -0,0 +1,12 @@ +arr = [1, 2, 3, 4, 5] +arr.each do |num| + puts num +end + +arr.each { |num| puts num } + +arr.each { |num| puts num if num > 3 } + +arr.each do |num| + puts num if num > 3 +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.19.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.19.txt new file mode 100644 index 00000000000..7bedd1ea199 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.19.txt @@ -0,0 +1,24 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + +def binary_search(arr, target): + left, right = 0, len(arr) - 1 + + while left <= right: + mid = (left + right) // 2 + + if arr[mid] == target: + return mid + elif arr[mid] < target: + left = mid + 1 + else: + right = mid - 1 + + return -1 + +target = 7 +result = binary_search(arr, target) + +if result != -1: + print(f"Element {target} found at index {result}.") +else: + print(f"Element {target} not found in the array.") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.2.txt index 1475343b084..a79044b5ceb 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.2.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.2.txt @@ -1 +1,24 @@ -arr = [1, 2, ]; \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def binary_search(arr, target) + low = 0 + high = arr.length - 1 + + while low <= high + mid = (low + high) / 2 + guess = arr[mid] + if guess == target + return mid + elsif guess > target + high = mid - 1 + else + low = mid + 1 + end + end + return nil +end + +puts binary_search(arr, 3) +puts binary_search(arr, -1) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.20.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.20.txt new file mode 100644 index 00000000000..8f52c18ddd3 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.20.txt @@ -0,0 +1,19 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + +def binary_search(arr, target): + low = 0 + high = len(arr) - 1 + + while low <= high: + mid = (low + high) // 2 + guess = arr[mid] + if guess == target: + return mid + if guess > target: + high = mid - 1 + else: + low = mid + 1 + return None + +print(binary_search(arr, 3)) +print(binary_search(arr, -1)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.21.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.21.txt new file mode 100644 index 00000000000..2cddd33a216 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.21.txt @@ -0,0 +1,11 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +sum = 0 +for i in arr: + sum += i +print(sum) + +# 2nd way +sum = 0 +for i in range(1, 11): + sum += i +print(sum) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.23.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.23.txt new file mode 100644 index 00000000000..64fa0554168 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.23.txt @@ -0,0 +1,21 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + +def binary_search(arr, target) + low = 0 + high = arr.length - 1 + + while low <= high + mid = (low + high) / 2 + guess = arr[mid] + if guess == target + return mid + elsif guess > target + high = mid - 1 + else + low = mid + 1 + end + end + return nil +end + +p binary_search(arr, 3) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.24.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.24.txt new file mode 100644 index 00000000000..91b796e4ed1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.24.txt @@ -0,0 +1,12 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +target = 10 + +def find_pairs(arr, target): + pairs = [] + for i in range(len(arr)): + for j in range(i + 1, len(arr)): + if arr[i] + arr[j] == target: + pairs.append((arr[i], arr[j])) + return pairs + +print(find_pairs(arr, target)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.3.txt index f1c5fe01d6c..3d7a5b27a02 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.3.txt @@ -1 +1,10 @@ -arr = [1, 2, 3, <<>> \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +sum = 0 +for i in arr: + sum += i +print(sum) + +# or + +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +print(sum(arr)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.4.txt index 47896849e9b..561015ed350 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.4.txt @@ -1 +1,23 @@ -arr = [1, 2, 3] \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + +def binary_search(arr, target) + low = 0 + high = arr.length - 1 + + while low <= high + mid = (low + high) / 2 + guess = arr[mid] + if guess == target + return mid + elsif guess > target + high = mid - 1 + else + low = mid + 1 + end + end + return nil +end + +p binary_search(arr, 3) +p binary_search(arr, -1) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.5.txt index 99569120f23..5510083e2cc 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.5.txt @@ -1 +1,18 @@ -arr = [1, 2, 3 \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +def binary_search(arr, target): + left, right = 0, len(arr) - 1 + while left <= right: + mid = (left + right) // 2 + if arr[mid] == target: + return mid + elif arr[mid] < target: + left = mid + 1 + else: + right = mid - 1 + return -1 +target = 7 +result = binary_search(arr, target) +if result != -1: + print(f"Element {target} found at index {result}.") +else: + print(f"Element {target} not found in the array.") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.6.txt index 18ab9d331df..0b2cc855dd9 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.6.txt @@ -1 +1,11 @@ -arr = [1, 2, 3, \ No newline at end of file +arr = [1, 2, 3, 4, 5] +arr2 = [1, 2, 3, 4, 5] + +def reverse(arr): + if len(arr) == 0: + return arr + else: + return reverse(arr[1:]) + arr[:1] + +print(reverse(arr)) +print(reverse(arr2)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.7.txt index 0955da4e993..7b5b98be324 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.7.txt @@ -1 +1,10 @@ -arr = [1, 2, 3, 4, 5]; \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +arr.each do |num| + if num > 5 + puts num + end +end + +# or + +arr.each { |num| puts num if num > 5 } \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.8.txt index f5b4a9a660c..5a6f2f11338 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.8.txt @@ -1 +1,10 @@ -arr = [1, 2, 3, 4, 5] \ No newline at end of file +arr = [1, 2, 3, 4, 5] +target = 9 + +def two_sum(arr, target): + for i in range(len(arr)): + for j in range(i+1, len(arr)): + if arr[i] + arr[j] == target: + return [i, j] + +print(two_sum(arr, target)) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.9.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.9.txt index a0046c27326..20ff640cdfe 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.approved.9.txt @@ -1 +1,23 @@ -arr = [1, 2, 3, 4] \ No newline at end of file +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +def binary_search(arr, target) + low = 0 + high = arr.length - 1 + + while low <= high + mid = (low + high) / 2 + guess = arr[mid] + if guess == target + return mid + elsif guess > target + high = mid - 1 + else + low = mid + 1 + end + end + return nil +end + +p binary_search(arr, 3) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.rejected.22.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.rejected.22.txt new file mode 100644 index 00000000000..6ae3e222e11 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rb.rejected.22.txt @@ -0,0 +1,8 @@ +arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] +# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + +def binary \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rejected.20.txt b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rejected.20.txt new file mode 100644 index 00000000000..0597b338671 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/array-declaration.rejected.20.txt @@ -0,0 +1,11 @@ +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] + +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +const evenNumbers = numbers.filter((number) => number % 2 === 0); + +console.log(evenNumbers); // [2, 4, 6, 8, 10] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.1.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.1.txt index 2560071fe5e..35bc719b079 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.1.txt @@ -1 +1,20 @@ -const config = {}; \ No newline at end of file +const config = require('../config'); +const jwt = require('jsonwebtoken'); + +const verifyToken = (req, res, next) => { + const token = req.headers['x-access-token']; + + if (!token) { + return res.status(403).send({ message: 'No token provided!' }); + } + + jwt.verify(token, config.secret, (err, decoded) => { + if (err) { + return res.status(401).send({ message: 'Unauthorized!' }); + } + req.userId = decoded.id; + next(); + }); +}; + +module.exports = verifyToken; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.10.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.10.txt new file mode 100644 index 00000000000..6648f3249b6 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.10.txt @@ -0,0 +1,19 @@ +const config = require('./config'); +const express = require('express'); +const app = express(); +const bodyParser = require('body-parser'); +const cors = require('cors'); +const mongoose = require('mongoose'); +const routes = require('./routes'); + +mongoose.connect(config.dbUrl, { useNewUrlParser: true, useUnifiedTopology: true }); + +app.use(cors()); +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: true })); + +app.use('/api', routes); + +app.listen(config.port, () => { + console.log(`Server started on port ${config.port}`); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.11.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.11.txt new file mode 100644 index 00000000000..82fee86bbb3 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.11.txt @@ -0,0 +1,20 @@ +const config = require('../config/config'); +const jwt = require('jsonwebtoken'); + +const verifyToken = (req, res, next) => { + const token = req.headers['x-access-token']; + + if (!token) { + return res.status(403).send({ message: "No token provided!" }); + } + + jwt.verify(token, config.secret, (err, decoded) => { + if (err) { + return res.status(401).send({ message: "Unauthorized!" }); + } + req.userId = decoded.id; + next(); + }); +}; + +module.exports = verifyToken; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.12.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.12.txt new file mode 100644 index 00000000000..a47778100fb --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.12.txt @@ -0,0 +1,11 @@ +const config = require('../config'); +const { get } = require('axios'); + +const getWeather = async (city) => { + const { data } = await get(`${config.weatherApiUrl}?q=${city}&appid=${config.weatherApiKey}&units=metric`); + return data; +}; + +module.exports = { + getWeather, +}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.13.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.13.txt new file mode 100644 index 00000000000..7840b147dc3 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.13.txt @@ -0,0 +1,3 @@ +const config = require('../config'); +const { get } = require('../utils/request'); + diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.14.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.14.txt new file mode 100644 index 00000000000..b2256a32291 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.14.txt @@ -0,0 +1,23 @@ +const config = require('../config.json'); +const Discord = require('discord.js'); +const fs = require('fs'); +const { MessageEmbed } = require('discord.js'); +const { Client, Collection, Intents } = require('discord.js'); +const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); + +module.exports = { + name: 'help', + description: 'Shows all commands', + execute(message, args) { + const embed = new MessageEmbed() + .setColor('#0099ff') + .setTitle('Help') + .setDescription('All commands') + .addFields( + { name: '!help', value: 'Shows all commands' }, + { name: '!ping', value: 'Pong!' }, + { name: '!server', value: 'Shows server info' }, + { name: '!user', value: 'Shows user info' }, + { name: '!avatar', value: 'Shows your avatar' }, + { name: '!kick', value: 'Kicks a user' }, + { name: '!ban', value: ' \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.15.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.15.txt new file mode 100644 index 00000000000..4f5d695d3b0 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.15.txt @@ -0,0 +1,23 @@ +const config = require('config'); +const jwt = require('jsonwebtoken'); +const bcrypt = require('bcryptjs'); +const _ = require('lodash'); +const { User, validate } = require('../models/user'); +const express = require('express'); +const router = express.Router(); + +router.post('/', async (req, res) => { + const { error } = validate(req.body); + if (error) return res.status(400).send(error.details[0].message); + + let user = await User.findOne({ email: req.body.email }); + if (!user) return res.status(400).send('Invalid email or password.'); + + const validPassword = await bcrypt.compare(req.body.password, user.password); + if (!validPassword) return res.status(400).send('Invalid email or password.'); + + const token = user.generateAuthToken(); + res.send(token); +}); + +module.exports = router; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.16.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.16.txt new file mode 100644 index 00000000000..832867503c3 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.16.txt @@ -0,0 +1,13 @@ +const config = require('../config'); + +const { Pool } = require('pg'); + +const pool = new Pool({ + user: config.db.user, + host: config.db.host, + database: config.db.database, + password: config.db.password, + port: config.db.port, +}); + +module.exports = pool; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.17.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.17.txt new file mode 100644 index 00000000000..dfdf78ac9a4 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.17.txt @@ -0,0 +1,10 @@ +const config = { + apiKey: "AIzaSyBj6m0j7Z8VU317QXJQZ5QZ5QZ5QZ5QZ5", + authDomain: "chat-app-123.firebaseapp.com", + projectId: "chat-app-123", + storageBucket: "chat-app-123.appspot.com", + messagingSenderId: "123456789", + appId: "1:123456789:web:123456789", +}; + +export default config; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.18.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.18.txt new file mode 100644 index 00000000000..3f2b394b7c5 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.18.txt @@ -0,0 +1,40 @@ +const config = require('config'); +const jwt = require('jsonwebtoken'); +const mongoose = require('mongoose'); +const Joi = require('joi'); + +const userSchema = new mongoose.Schema({ + name: { + type: String, + required: true, + minlength: 5, + maxlength: 50 + }, + email: { + type: String, + required: true, + minlength: 5, + maxlength: 255, + unique: true + }, + password: { + type: String, + required: true, + minlength: 5, + maxlength: 1024 + }, + isAdmin: Boolean +}); + +userSchema.methods.generateAuthToken = function() { + const token = jwt.sign({ _id: this._id, isAdmin: this.isAdmin }, config.get('jwtPrivateKey')); + return token; +} + +const User = mongoose.model('User', userSchema); + +function validateUser(user) { + const schema = { + name: Joi.string().min(5).max(50).required(), + email: Joi.string().min(5).max(255).required().email(), + password: Joi.string().min(5).max( \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.19.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.19.txt new file mode 100644 index 00000000000..577d2a2db8d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.19.txt @@ -0,0 +1,10 @@ +const config = require('../config.json'); +const Discord = require('discord.js'); + +module.exports = { + name: 'ping', + description: 'Ping!', + execute(message, args) { + message.channel.send('Pong!'); + }, +}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.2.txt index 959d0a06fc8..f51ff4dcaaf 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.2.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.2.txt @@ -1 +1,20 @@ -const config = {<<>>} \ No newline at end of file +const config = require('../config'); +const mongoose = require('mongoose'); + +const connectDB = async () => { + try { + const conn = await mongoose.connect(config.MONGO_URI, { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, + useCreateIndex: true + }); + + console.log(`MongoDB Connected: ${conn.connection.host}`.cyan.underline.bold); + } catch (error) { + console.error(`Error: ${error.message}`.red); + process.exit(1); + } +} + +module.exports = connectDB; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.20.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.20.txt new file mode 100644 index 00000000000..7b7fc494f7f --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.20.txt @@ -0,0 +1,7 @@ +const config = require('../config/config.json'); +const jwt = require('jsonwebtoken'); + +module.exports = { + generateToken, + verifyToken +} \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.21.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.21.txt new file mode 100644 index 00000000000..76f8a4354fc --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.21.txt @@ -0,0 +1,10 @@ +const config = require('../config/config'); +const jwt = require('jsonwebtoken'); + +const generateToken = (user) => { + return jwt.sign(user, config.secret, { + expiresIn: 86400 // expires in 24 hours + }); +} + +module.exports = generateToken; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.22.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.22.txt new file mode 100644 index 00000000000..ef0fb71822e --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.22.txt @@ -0,0 +1,21 @@ +const config = require('../config/config'); +const jwt = require('jsonwebtoken'); + +function verifyToken(req, res, next) { + const token = req.headers['x-access-token']; + if (!token) { + return res.status(403).send({ auth: false, message: 'No token provided.' }); + } + + jwt.verify(token, config.secret, function (err, decoded) { + if (err) { + return res.status(500).send({ auth: false, message: 'Failed to authenticate token.' }); + } + + // if everything good, save to request for use in other routes + req.userId = decoded.id; + next(); + }); +} + +module.exports = verifyToken; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.23.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.23.txt new file mode 100644 index 00000000000..38462e1d529 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.23.txt @@ -0,0 +1,13 @@ +const config = require('../config/config'); + +const { Pool } = require('pg'); + +const pool = new Pool({ + user: config.db.user, + host: config.db.host, + database: config.db.database, + password: config.db.password, + port: config.db.port, +}); + +module.exports = pool; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.24.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.24.txt new file mode 100644 index 00000000000..27ba91b202b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.24.txt @@ -0,0 +1,22 @@ +const config = require('../config'); +const jwt = require('jsonwebtoken'); + +module.exports = (req, res, next) => { + const token = req.headers['x-access-token'] || req.body.token || req.query.token; + + if (token) { + jwt.verify(token, config.secret, (err, decoded) => { + if (err) { + return res.status(403).json({ success: false, message: 'Failed to authenticate token.' }); + } else { + req.decoded = decoded; + next(); + } + }); + } else { + return res.status(403).send({ + success: false, + message: 'No token provided.' + }); + } +}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.25.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.25.txt new file mode 100644 index 00000000000..95ae831bb7c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.25.txt @@ -0,0 +1,19 @@ +const config = require('./config'); +const express = require('express'); +const app = express(); +const bodyParser = require('body-parser'); +const cors = require('cors'); +const mongoose = require('mongoose'); +const routes = require('./routes'); + +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: true })); +app.use(cors()); + +mongoose.connect(config.dbUrl, { useNewUrlParser: true, useUnifiedTopology: true }); + +app.use('/', routes); + +app.listen(config.port, () => { + console.log(`Server is running on port ${config.port}`); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.3.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.3.txt index 4558a6c76c9..fa4a9191412 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.3.txt @@ -1 +1,11 @@ -const config = {} \ No newline at end of file +const config = require('../config'); +const { get } = require('../utils/request'); + +const getUser = async (id) => { + const url = `${config.apiUrl}/users/${id}`; + return get(url); +}; + +module.exports = { + getUser, +}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.4.txt index 89cddfb6a61..10ba4030cdd 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.4.txt @@ -1 +1,23 @@ -const config = { /* Add configuration properties here */ } \ No newline at end of file +const config = require('../config/config'); +const jwt = require('jsonwebtoken'); + +const verifyToken = (req, res, next) => { + const token = req.headers['x-access-token']; + if (!token) { + return res.status(403).send({ + message: 'No token provided!' + }); + } + + jwt.verify(token, config.secret, (err, decoded) => { + if (err) { + return res.status(401).send({ + message: 'Unauthorized!' + }); + } + req.userId = decoded.id; + next(); + }); +}; + +module.exports = verifyToken; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.5.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.5.txt index 2036c6da6db..d02d071e52e 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.5.txt @@ -1,3 +1,15 @@ -const config = { - // Configuration object +const config = require('../config'); + +const { get } = require('../utils/request'); + +const getUserInfo = async (accessToken, openId) => { + const url = `${config.mpApiHost}/sns/userinfo?access_token=${accessToken}&openid=${openId}&lang=zh_CN`; + + const result = await get(url); + + return result; +}; + +module.exports = { + getUserInfo, }; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.6.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.6.txt index e6b5827f5e5..5a1f0a13062 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.6.txt @@ -1,2 +1,12 @@ -const config = { -} \ No newline at end of file +const config = require('../config'); +const { get } = require('axios'); + +const getWeather = async (city) => { + const url = `${config.weatherApi.url}?q=${city}&appid=${config.weatherApi.key}&units=metric`; + const response = await get(url); + return response.data; +}; + +module.exports = { + getWeather, +}; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.7.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.7.txt index 5738f26030d..d4c9598c1f3 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.7.txt @@ -1,3 +1,18 @@ -const config = { - // Your configuration properties here -} \ No newline at end of file +const config = require('./config'); +const express = require('express'); +const app = express(); +const bodyParser = require('body-parser'); +const cors = require('cors'); +const mongoose = require('mongoose'); +const routes = require('./routes'); + +mongoose.connect(config.db, { useNewUrlParser: true, useUnifiedTopology: true }); + +app.use(bodyParser.json()); +app.use(cors()); + +app.use('/api', routes); + +app.listen(config.port, () => { + console.log(`Server is running on port ${config.port}`); +}); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.8.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.8.txt index cfca448a870..af4170eac23 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.8.txt @@ -1,4 +1,13 @@ -const config = { - apiKey: process.env.OPENAI_API_KEY, - organization: process.env.OPENAI_ORGANIZATION, -} \ No newline at end of file +const config = require('../config'); + +const { Pool } = require('pg'); + +const pool = new Pool({ + user: config.dbUser, + host: config.dbHost, + database: config.dbName, + password: config.dbPassword, + port: config.dbPort, +}); + +module.exports = pool; \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.9.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.9.txt new file mode 100644 index 00000000000..2f57864ec6a --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.approved.9.txt @@ -0,0 +1,35 @@ +const config = require('../config.json'); +const Discord = require('discord.js'); +const fs = require('fs'); +const { Client, Collection, Intents } = require('discord.js'); + +const client = new Client({ intents: [Intents.FLAGS.GUILDS] }); + +client.commands = new Collection(); +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); + +for (const file of commandFiles) { + const command = require(`./commands/${file}`); + client.commands.set(command.data.name, command); +} + +client.once('ready', () => { + console.log('Ready!'); +}); + +client.on('interactionCreate', async interaction => { + if (!interaction.isCommand()) return; + + const command = client.commands.get(interaction.commandName); + + if (!command) return; + + try { + await command.execute(interaction); + } catch (error) { + console.error(error); + await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); + } +}); + +client.login(config.token); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.1.txt index 1a8fa18c599..30105b51e6c 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.1.txt @@ -1,3 +1,12 @@ user = { name: 'John', - email: 'john@example.com' \ No newline at end of file + email: 'john@email.com', + password: 'password' +} + +puts user[:name] +puts user[:email] +puts user[:password] + +user[:name] = 'Jane' +puts user[:name] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.2.txt new file mode 100644 index 00000000000..36070c70884 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.2.txt @@ -0,0 +1,8 @@ +user = { + name: 'John', + email: 'john@email.com', + password: 'password', + password_confirmation: 'password' +} + +User.create(user) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.3.txt index a87aa05793e..fae507e6307 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.3.txt @@ -1,4 +1,13 @@ user = { name: 'John', - email: 'john@example.com', - <<>> \ No newline at end of file + email: 'john@email.com', + password: 'password' +} + +puts user[:name] +puts user[:email] +puts user[:password] + +user.each do |key, value| + puts "The key is #{key} and the value is #{value}" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.4.txt new file mode 100644 index 00000000000..d3a0ce2cdb8 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.4.txt @@ -0,0 +1,12 @@ +user = { + name: 'John', + email: 'john@email.com', + password: 'password' +} + +puts user[:name] +puts user[:email] +puts user[:password] + +user[:password] = 'new_password' +puts user[:password] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.5.txt index d320b66eb4d..af0e5df02ab 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.5.txt @@ -1,4 +1,17 @@ user = { name: 'John', email: 'john@example.com', -} \ No newline at end of file + password: 'password' +} + +User.create(user) + +10.times do |i| + post = { + title: "Post #{i}", + content: "Content #{i}", + user_id: 1 + } + + Post.create(post) +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.6.txt index 68558a07adf..a027fde455e 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.6.txt @@ -1,3 +1,12 @@ user = { name: 'John', - email: 'john@example.com', \ No newline at end of file + email: 'john@email.com', + password: 'password' +} + +puts user[:name] +puts user[:email] +puts user[:password] + +user[:name] = 'Jack' +puts user[:name] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.7.txt new file mode 100644 index 00000000000..6b2ee5a1ec1 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.7.txt @@ -0,0 +1,13 @@ +user = { + name: 'John', + email: 'john@email.com', + password: 'password' +} + +puts "Name: #{user[:name]}" +puts "Email: #{user[:email]}" +puts "Password: #{user[:password]}" + +user.each do |key, value| + puts "Key: #{key}, Value: #{value}" +end \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.8.txt new file mode 100644 index 00000000000..9f76f873efd --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.8.txt @@ -0,0 +1,11 @@ +user = { + name: 'John', + email: 'john@email.com', + password: 'password' +} + +puts user[:name] + +user[:name] = 'Jack' + +puts user[:name] \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.9.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.9.txt new file mode 100644 index 00000000000..b5aeb4f8238 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.approved.9.txt @@ -0,0 +1,10 @@ +user = { + name: 'John', + email: 'john@doe.com', + password: 'password' +} + +user[:name] = 'Jane' +user[:email] = 'jane@doe.com' + +puts user \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.rejected.2.txt deleted file mode 100644 index aedaf672e32..00000000000 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.rejected.2.txt +++ /dev/null @@ -1,3 +0,0 @@ -user = { - name: 'John', - email: <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.rejected.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.rejected.4.txt deleted file mode 100644 index 2a41222722c..00000000000 --- a/src/test-llm-autocompletion/approvals/variable-assignment/object-declaration.rb.rejected.4.txt +++ /dev/null @@ -1 +0,0 @@ -(no changes parsed) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.1.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.1.txt index d31fc884690..64bf474dd75 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.1.txt @@ -1 +1,27 @@ -const userName = ""; \ No newline at end of file +const userName = "John"; +const userQuestion = "Will I become a werewolf tonight?"; +const randomNumber = Math.floor(Math.random() * 8); +let eightBall = ""; + +if (randomNumber === 0) { + eightBall = "It is certain"; +} else if (randomNumber === 1) { + eightBall = "It is decidedly so"; +} else if (randomNumber === 2) { + eightBall = "Reply hazy try again"; +} else if (randomNumber === 3) { + eightBall = "Cannot predict now"; +} else if (randomNumber === 4) { + eightBall = "Do not count on it"; +} else if (randomNumber === 5) { + eightBall = "My sources say no"; +} else if (randomNumber === 6) { + eightBall = "Outlook not so good"; +} else if (randomNumber === 7) { + eightBall = "Signs point to yes"; +} else { + eightBall = "Invalid number"; +} + +console.log(`The user ${userName} asked: ${userQuestion}`); +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.10.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.10.txt new file mode 100644 index 00000000000..4ba1f30eaec --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.10.txt @@ -0,0 +1,41 @@ +const userName = 'Jane'; +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + eightBall = 'Invalid number'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.11.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.11.txt new file mode 100644 index 00000000000..80f3dc0ca43 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.11.txt @@ -0,0 +1,44 @@ +const userName = "John"; +const userQuestion = "Will I become a werewolf tonight?"; +const randomNumber = Math.floor(Math.random() * 8); +let eightBall = ""; + +if (userName === "") { + console.log("Hello!"); +} else { + console.log(`Hello, ${userName}!`); +} + +console.log(`The user asked: ${userQuestion}`); + +switch (randomNumber) { + case 0: + eightBall = "It is certain"; + break; + case 1: + eightBall = "It is decidedly so"; + break; + case 2: + eightBall = "Reply hazy try again"; + break; + case 3: + eightBall = "Cannot predict now"; + break; + case 4: + eightBall = "Do not count on it"; + break; + case 5: + eightBall = "My sources say no"; + break; + case 6: + eightBall = "Outlook not so good"; + break; + case 7: + eightBall = "Signs point to yes"; + break; + default: + eightBall = "Invalid number"; + break; +} + +console.log(`The eight ball answered: ${eightBall \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.12.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.12.txt new file mode 100644 index 00000000000..5db657da33d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.12.txt @@ -0,0 +1,27 @@ +const userName = "Jane"; +userQuestion = "Will I become a werewolf tonight?"; +randomNumber = Math.floor(Math.random() * 8); +eightBall = ""; + +if (randomNumber === 0) { + eightBall = "It is certain"; +} else if (randomNumber === 1) { + eightBall = "It is decidedly so"; +} else if (randomNumber === 2) { + eightBall = "Reply hazy try again"; +} else if (randomNumber === 3) { + eightBall = "Cannot predict now"; +} else if (randomNumber === 4) { + eightBall = "Do not count on it"; +} else if (randomNumber === 5) { + eightBall = "My sources say no"; +} else if (randomNumber === 6) { + eightBall = "Outlook not so good"; +} else if (randomNumber === 7) { + eightBall = "Signs point to yes"; +} else { + eightBall = "Invalid number"; +} + +console.log(`The user ${userName} asked: ${userQuestion}`); +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.13.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.13.txt new file mode 100644 index 00000000000..7b290f6ee49 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.13.txt @@ -0,0 +1,43 @@ +const userName = 'Jane'; + +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; + +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + eightBall = 'I am not sure'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.2.txt new file mode 100644 index 00000000000..c5719bf39cd --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.2.txt @@ -0,0 +1,43 @@ +const userName = 'Jane'; + +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; + +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + eightBall = 'Error'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.3.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.3.txt index c62f88ff510..7dc3220a7f4 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.3.txt @@ -1 +1,38 @@ -const userName = "" \ No newline at end of file +const userName = 'Jane'; +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.4.txt index e4d6417c750..2278243f4d3 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.4.txt @@ -1 +1,43 @@ -const userName = ''; \ No newline at end of file +const userName = 'Jane'; + +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; + +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + eightBall = 'Invalid number'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.5.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.5.txt index 6ba4b607048..2c802c01a44 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.5.txt @@ -1 +1,41 @@ -const userName = "John Doe"; \ No newline at end of file +const userName = 'Jane'; +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + console.log('Error'); + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.6.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.6.txt index 5b9bf1dbf47..051392df7c3 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.6.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.6.txt @@ -1 +1,40 @@ -const userName = '' \ No newline at end of file +const userName = 'Jane'; + +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; + +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.7.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.7.txt index 397ac2bdf1c..1cb4560a937 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.7.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.7.txt @@ -1 +1,41 @@ -const userName = 'John Doe'; \ No newline at end of file +const userName = 'Jane'; +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch (randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + eightBall = 'Error'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.8.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.8.txt index 822d500ad92..98533eed077 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.8.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.8.txt @@ -1 +1,41 @@ -const userName = "getUserName()"; \ No newline at end of file +const userName = 'Jane'; +userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); + +const userQuestion = 'Will I become a werewolf tonight?'; +console.log(`${userName} asked: ${userQuestion}`); + +const randomNumber = Math.floor(Math.random() * 8); + +let eightBall = ''; + +switch(randomNumber) { + case 0: + eightBall = 'It is certain'; + break; + case 1: + eightBall = 'It is decidedly so'; + break; + case 2: + eightBall = 'Reply hazy try again'; + break; + case 3: + eightBall = 'Cannot predict now'; + break; + case 4: + eightBall = 'Do not count on it'; + break; + case 5: + eightBall = 'My sources say no'; + break; + case 6: + eightBall = 'Outlook not so good'; + break; + case 7: + eightBall = 'Signs point to yes'; + break; + default: + eightBall = 'Error'; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.9.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.9.txt index c31cb4e234f..69a2208e649 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.9.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.approved.9.txt @@ -1 +1,38 @@ -const userName = "John Doe" \ No newline at end of file +const userName = "John"; +const userQuestion = "Will I become a werewolf tonight?"; +const randomNumber = Math.floor(Math.random() * 8); +let eightBall = ""; + +console.log(userName + " asked: " + userQuestion); + +switch (randomNumber) { + case 0: + eightBall = "It is certain"; + break; + case 1: + eightBall = "It is decidedly so"; + break; + case 2: + eightBall = "Reply hazy try again"; + break; + case 3: + eightBall = "Cannot predict now"; + break; + case 4: + eightBall = "Do not count on it"; + break; + case 5: + eightBall = "My sources say no"; + break; + case 6: + eightBall = "Outlook not so good"; + break; + case 7: + eightBall = "Signs point to yes"; + break; + default: + eightBall = "Invalid number"; + break; +} + +console.log(`The eight ball answered: ${eightBall}`); \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.1.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.1.txt index feae1c48d40..9d234b7914f 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.1.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.1.txt @@ -1,2 +1,10 @@ x = 10 -y = 20 \ No newline at end of file +y = 20 +z = 30 + +if x > y: + print("x is greater than y") +elif x > z: + print("x is greater than z") +else: + print("x is not greater than y or z") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.10.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.10.txt new file mode 100644 index 00000000000..227debd4578 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.10.txt @@ -0,0 +1,10 @@ +x = 10 +y = 20 + +print(x+y) +print(x-y) +print(x*y) +print(x/y) +print(x//y) +print(x%y) +print(x**y) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.2.txt new file mode 100644 index 00000000000..eb67764dc0b --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.2.txt @@ -0,0 +1,10 @@ +x = 10 +y = 20 + +print(x + y) +print(x - y) +print(x * y) +print(x / y) +print(x // y) +print(x % y) +print(x ** y) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.3.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.3.txt index 3478e68bb19..76339de5bb5 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.3.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.3.txt @@ -1,2 +1,16 @@ x = 10 -y = 10 \ No newline at end of file +y = 20 + +print(x + y) + +print(x - y) + +print(x * y) + +print(x / y) + +print(x % y) + +print(x ** y) + +print(x // y) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.4.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.4.txt index 05d375dc9e5..b96133a7eaf 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.4.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.4.txt @@ -1,2 +1,10 @@ x = 10 -y = 0 \ No newline at end of file +y = 20 +z = 30 + +if x > y: + print("x is greater than y") +elif y > z: + print("y is greater than z") +else: + print("z is greater than x and y") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.5.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.5.txt index 91909610522..94c648c50a2 100644 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.5.txt +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.5.txt @@ -1,2 +1,17 @@ x = 10 -y = 20; \ No newline at end of file +y = 20 +z = 30 + +if x > y: + print("x is greater than y") +elif x < y: + print("x is less than y") +else: + print("x is equal to y") + +if x > y and x > z: + print("x is the greatest") +elif y > x and y > z: + print("y is the greatest") +else: + print("z is the greatest") \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.6.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.6.txt new file mode 100644 index 00000000000..a4ef2fdd59c --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.6.txt @@ -0,0 +1,16 @@ +x = 10 +y = 20 + +print(x+y) + +print(x-y) + +print(x*y) + +print(x/y) + +print(x%y) + +print(x**y) + +print(x//y) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.7.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.7.txt new file mode 100644 index 00000000000..2f035e56675 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.7.txt @@ -0,0 +1,10 @@ +x = 10 +y = 20 + +print(x + y) +print(x - y) +print(x * y) +print(x / y) +print(x % y) +print(x ** y) +print(x // y) \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.8.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.8.txt new file mode 100644 index 00000000000..a179eb97c73 --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.approved.8.txt @@ -0,0 +1,11 @@ +x = 10 +y = 10 + +if x > y: + print("x is greater than y") +elif x == y: + print("x is equal to y") +else: + print("x is less than y") + +# x is equal to y \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.rejected.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.rejected.2.txt deleted file mode 100644 index 734de022f58..00000000000 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.rejected.2.txt +++ /dev/null @@ -1,2 +0,0 @@ -x = 10 -y = <<>> \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.rejected.9.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.rejected.9.txt new file mode 100644 index 00000000000..ff0b163054d --- /dev/null +++ b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rb.rejected.9.txt @@ -0,0 +1,14 @@ +x = 10 +y = 20 + +print(x + y) + +# print(x + y + z) # NameError: name 'z' is not defined + +# print(x + y + "z") # TypeError: unsupported operand type(s) for +: 'int' and 'str' + +# print(x + y + z) # NameError: name 'z' is not defined + +# print(x + y + z) # NameError: name 'z' is not defined + +# print(x + y + z) # NameError: name 'z' is not defined \ No newline at end of file diff --git a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rejected.2.txt b/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rejected.2.txt deleted file mode 100644 index 85d528e2b86..00000000000 --- a/src/test-llm-autocompletion/approvals/variable-assignment/variable-assignment.rejected.2.txt +++ /dev/null @@ -1 +0,0 @@ -const userName = ; \ No newline at end of file diff --git a/src/test-llm-autocompletion/runner.ts b/src/test-llm-autocompletion/runner.ts index c9f0795f15b..da55de49b4a 100644 --- a/src/test-llm-autocompletion/runner.ts +++ b/src/test-llm-autocompletion/runner.ts @@ -83,7 +83,7 @@ export class TestRunner { return !result.isApproved && result.newOutput === true && this.skipApproval } - async runAllTests(): Promise { + async runAllTests(numRuns: number = 1): Promise { const model = process.env.LLM_MODEL || "mistralai/codestral-2508" const strategyName = this.tester.getName() @@ -91,6 +91,9 @@ export class TestRunner { console.log("Provider: kilocode") console.log("Model:", model) console.log("Strategy:", strategyName) + if (numRuns > 1) { + console.log("Runs per test:", numRuns) + } if (this.skipApproval) { console.log("Skip Approval: enabled (tests will fail if not already approved)") } @@ -108,54 +111,85 @@ export class TestRunner { const categoryTests = testCases.filter((tc) => tc.category === category) for (const testCase of categoryTests) { - process.stdout.write(` Running ${testCase.name} [${strategyName}]... `) - - const result = await this.runTest(testCase) - result.strategyName = strategyName - this.results.push(result) + if (numRuns > 1) { + console.log(` Running ${testCase.name} [${strategyName}] (${numRuns} runs)...`) + } else { + process.stdout.write(` Running ${testCase.name} [${strategyName}]... `) + } - if (result.isApproved) { - console.log("✓ PASSED") - if (result.newOutput) { - console.log(` (New output approved)`) + const runResults: TestResult[] = [] + for (let run = 0; run < numRuns; run++) { + const result = await this.runTest(testCase) + result.strategyName = strategyName + runResults.push(result) + this.results.push(result) + + if (numRuns > 1) { + const status = result.isApproved ? "✓" : this.isUnknownResult(result) ? "?" : "✗" + process.stdout.write(` Run ${run + 1}/${numRuns}: ${status}`) + if (result.llmRequestDuration) { + process.stdout.write(` (${result.llmRequestDuration.toFixed(0)}ms)`) + } + console.log() } - } else if (this.isUnknownResult(result)) { - console.log("? UNKNOWN") - console.log(` (New output without approval)`) - } else { - console.log("✗ FAILED") - if (result.error) { - console.log(` Error: ${result.error}`) + } + + // For single run, show result inline; for multiple runs, show summary + if (numRuns === 1) { + const result = runResults[0] + if (result.isApproved) { + console.log("✓ PASSED") + if (result.newOutput) { + console.log(` (New output approved)`) + } + } else if (this.isUnknownResult(result)) { + console.log("? UNKNOWN") + console.log(` (New output without approval)`) } else { - console.log(` Input:`) - console.log(" " + "─".repeat(76)) - console.log( - testCase.input - .split("\n") - .map((l) => " " + l) - .join("\n"), - ) - console.log(" " + "─".repeat(76)) - console.log(` Got:`) - console.log(" " + "─".repeat(76)) - console.log( - (result.actualValue || "") - .split("\n") - .map((l) => " " + l) - .join("\n"), - ) - console.log(" " + "─".repeat(76)) - - if (this.verbose && result.completion) { - console.log(" Full LLM Response:") + console.log("✗ FAILED") + if (result.error) { + console.log(` Error: ${result.error}`) + } else { + console.log(` Input:`) + console.log(" " + "─".repeat(76)) console.log( - result.completion + testCase.input .split("\n") - .map((l) => " " + l) + .map((l) => " " + l) .join("\n"), ) + console.log(" " + "─".repeat(76)) + console.log(` Got:`) + console.log(" " + "─".repeat(76)) + console.log( + (result.actualValue || "") + .split("\n") + .map((l) => " " + l) + .join("\n"), + ) + console.log(" " + "─".repeat(76)) + + if (this.verbose && result.completion) { + console.log(" Full LLM Response:") + console.log( + result.completion + .split("\n") + .map((l) => " " + l) + .join("\n"), + ) + } } } + } else { + // Summary for multiple runs + const passed = runResults.filter((r) => r.isApproved).length + const failed = runResults.filter((r) => !r.isApproved && !this.isUnknownResult(r)).length + const unknown = runResults.filter((r) => this.isUnknownResult(r)).length + const passRate = ((passed / numRuns) * 100).toFixed(0) + console.log(` Summary: ${passed}/${numRuns} passed (${passRate}%)`) + if (failed > 0) { + console.log(` Failed: ${failed}, Unknown: ${unknown}`) + } } if (this.verbose) { @@ -255,7 +289,7 @@ export class TestRunner { process.exit(failed > 0 ? 1 : 0) } - async runSingleTest(testName: string): Promise { + async runSingleTest(testName: string, numRuns: number = 10): Promise { const testCase = testCases.find((tc) => tc.name === testName) if (!testCase) { console.error(`Test "${testName}" not found`) @@ -264,8 +298,6 @@ export class TestRunner { process.exit(1) } - const numRuns = 10 - console.log(`\n🧪 Running Single Test: ${testName} (${numRuns} times)\n`) console.log("Category:", testCase.category) console.log("Description:", testCase.description) @@ -411,7 +443,17 @@ async function main() { const skipApproval = args.includes("--skip-approval") || args.includes("-sa") const useOpusApproval = args.includes("--opus-approval") || args.includes("-oa") - const command = args.find((arg) => !arg.startsWith("-")) + // Parse --runs or -r option + let numRuns = 1 + const runsIndex = args.findIndex((arg) => arg === "--runs" || arg === "-r") + if (runsIndex !== -1 && args[runsIndex + 1]) { + const parsedRuns = parseInt(args[runsIndex + 1], 10) + if (!isNaN(parsedRuns) && parsedRuns > 0) { + numRuns = parsedRuns + } + } + + const command = args.find((arg) => !arg.startsWith("-") && args.indexOf(arg) !== runsIndex + 1) const runner = new TestRunner(verbose, skipApproval, useOpusApproval) @@ -419,9 +461,9 @@ async function main() { if (command === "clean") { await runner.cleanApprovals() } else if (command) { - await runner.runSingleTest(command) + await runner.runSingleTest(command, numRuns) } else { - await runner.runAllTests() + await runner.runAllTests(numRuns) } } catch (error) { console.error("\n❌ Fatal Error:", error)