Adding all tracks, I guess

This commit is contained in:
2018-08-14 17:28:48 -05:00
parent 51aa078388
commit fab045379a
47 changed files with 3402 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# Hello World
The classical introductory exercise. Just say "Hello, World!".
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
the traditional first program for beginning programming in a new language
or environment.
The objectives are simple:
- Write a function that returns the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.
If everything goes well, you will be ready to fetch your first real exercise.
## Setup
Go through the setup instructions for PL/SQL to get ready to code:
http://exercism.io/languages/plsql
## Running the Tests
Execute the tests by calling the `run` method in the respective `ut_<exercise>#` package.
The necessary code should be contained at the end of the test package.
As an example, the test for the _hamming_ exercise would be run using
```
begin
ut_hamming#.run;
end;
/
```
## Source
This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

View File

@@ -0,0 +1,20 @@
CREATE OR REPLACE PACKAGE hello_world# IS
FUNCTION hello(
i_name varchar2 := ''
)
RETURN varchar2;
END hello_world#;
/
CREATE OR REPLACE PACKAGE BODY hello_world# IS
FUNCTION hello(
i_name varchar2 := ''
)
RETURN varchar2
AS
BEGIN
RETURN NULL;
END hello;
END hello_world#;
/

View File

@@ -0,0 +1,60 @@
CREATE OR REPLACE PACKAGE ut_hello_world#
IS
PROCEDURE run;
END ut_hello_world#;
/
CREATE OR REPLACE PACKAGE BODY ut_hello_world#
IS
PROCEDURE TEST (
i_descn varchar2,
i_exp varchar2,
i_act varchar2
)
IS
BEGIN
IF i_exp = i_act THEN
dbms_output.put_line('SUCCESS: ' || i_descn);
ELSE
dbms_output.put_line(
'FAILURE: ' || i_descn ||
': expected ''' || NVL('' || i_exp, 'NULL') ||
''', but got ''' || NVL('' || i_act, 'null') || '''!'
);
END IF;
END TEST;
PROCEDURE run
IS
BEGIN
TEST(
i_descn => 'no name',
i_exp => 'Hello, World!',
i_act => hello_world#.hello()
);
TEST(
i_descn => 'sample name',
i_exp => 'Hello, Alice!',
i_act => hello_world#.hello('Alice')
);
TEST(
i_descn => 'other sample name',
i_exp => 'Hello, Bob!',
i_act => hello_world#.hello('Bob')
);
EXCEPTION
WHEN others THEN
dbms_output.put_line('Test execution failed.');
dbms_output.put_line(sqlerrm);
END run;
END ut_hello_world#;
/
BEGIN
ut_hello_world#.run;
END;
/