Oopm1516 Ex07

Zielsetzung für die Übung

  • Testen
    • Blackbox Testing
      • Testen anhand der Spezifikation
    • Glassbox Testing (Codeabdeckung)
      • alle Anweisungen
      • alle Zweige
      • alle Teilbedingungen (wdh. Shortcuts)
      • alle Pfaden

Black-Box-Testing

docs.oracle.com/javase/7/docs/api/java/lang/String.html

public String substring(int beginIndex)

Returns a new string that is a substring of this string. 
The substring begins with the character at the specified index and extends to the end of this string.

Examples:

     "unhappy".substring(2) returns "happy"
     "Harbison".substring(3) returns "bison"
     "emptiness".substring(9) returns "" (an empty string)

Parameters:
    beginIndex - the beginning index, inclusive.
Returns:
    the specified substring.
Throws:
    IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object.

Glass-Box-Testing

A simple example:

Input: a, b integers

1        function compare(a, b)
2            if a > b then return "a is greater than b"
3            if a < b then return "b is greater than a"
4            if a = b then return "a is equal to b"

https://en.wikipedia.org/wiki/Greatest_common_divisor#Binary_method

Input: a, b positive integers
Output: g and d such that g is odd and gcd(a, b) = g×2d

1        d := 0
2        while a and b are both even do
3            a := a/2
4            b := b/2
5            d := d + 1
6        while a ≠ b do
7            if a is even then a := a/2
8            else if b is even then b := b/2
9            else if a > b then a := (a – b)/2
10            else b := (b – a)/2
11        g := a
12        output g, d

Zielsetzung für das Programmierpraktikum

  • Implementation von numerischen Verfahren
    • Methoden ohne Verwendung der Bibliothek Math
    • Intervallschachtelung & Sinus-Funktion
      • Umgangsweise mit Delta