AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Werkzeuge Programme bzw. Funktionen von KI schreiben lassen (OpenAI)
Thema durchsuchen
Ansicht
Themen-Optionen

Programme bzw. Funktionen von KI schreiben lassen (OpenAI)

Ein Thema von Harry Stahl · begonnen am 14. Dez 2022 · letzter Beitrag vom 4. Okt 2023
 
Benutzerbild von Phoenix
Phoenix
(Moderator)

Registriert seit: 25. Jun 2002
Ort: Hausach
7.645 Beiträge
 
#12

AW: Programme bzw. Funktionen von KI schreiben lassen (OpenAI)

  Alt 15. Dez 2022, 10:41
Schließlich hat der Chatbot seine Intelligenz ja auch nur aus dem Internet und der dort herumgeisternde Code ist zuweilen schon recht grenzwertig, was das Pacman-Beispiel ja sehr deutlich aufzeigt.
Ich denke auch, das ist copy and paste von irgendwo gefundenem Code.
Ist es nicht. ChatGPT erstellt ein semantisches und syntaktisches Modell der generierten Antwort (und damit auch des generierten Codes).
Du kannst ihm spezifisch sagen was Du geändert haben möchtest, z.B. das Du möchtest das der Methodenname mit Combine beginnt statt mit Add. Er versteht auch - zumindest grob - den Inhalt der Funktion und kann passende Unit-Tests generieren:

Zitat von Phoenix:
Now please write a unit test for this function that tests specifically the extreme values for frequency and offset
Zitat von ChatGPT:
Here is an example of a unit test for the CombineSinusWaves function that tests the extreme values for frequency and offset:
Code:
function TestCombineSinusWaves: Boolean;
begin
  Result := False;
  if CombineSinusWaves(0, 0) <> 0 then Exit;
  if CombineSinusWaves(0, 1) <> 0 then Exit;
  if CombineSinusWaves(1, 0) <> 2 then Exit;
  if CombineSinusWaves(1, 1) <> 2 then Exit;
  Result := True;
end;
This unit test has four test cases:

The test case CombineSinusWaves(0, 0) tests the function with a frequency of 0 Hz and an offset of 0%. The expected result is 0, since a sinus wave with a frequency of 0 Hz is a constant value of 0.
The test case CombineSinusWaves(0, 1) tests the function with a frequency of 0 Hz and an offset of 100%. The expected result is still 0, since the offset does not affect the result when the frequency is 0 Hz.
The test case CombineSinusWaves(1, 0) tests the function with a frequency of 1 Hz and an offset of 0%. The expected result is 2, since the two sinus waves with a frequency of 1 Hz have the same amplitude and are in phase, so their sum is twice the amplitude of a single wave.
The test case CombineSinusWaves(1, 1) tests the function with a frequency of 1 Hz and an offset of 100%. The expected result is still 2, since the offset does not affect the result when the frequency is 1 Hz.
If all of these test cases pass, the TestCombineSinusWaves function will return True, indicating that the CombineSinusWaves function is working correctly for the extreme values of frequency and offset.
Sebastian Gingter
Phoenix - 不死鳥, Microsoft MVP, Rettungshundeführer
Über mich: Sebastian Gingter @ Thinktecture Mein Blog: https://gingter.org
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:21 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz