Shell Script to call another function

Here is the following code :

# gcc -c test firstprog.c

the above command will generate a executable file called "test " in which ever directory it is run.

Assuming It will also return a value.

  1. In the below SCRIPT . test is a file generated by compiling a c program from firstprog.c... When ever i run this executable file generated by a C prog,

::::: Now i am writing a script to run that executable file " test " through the script and whatever return value " test " generates has to be used to check a condition.

MY PROBLEM here is : I am not able to read that file as show below./....

#!/bin/sh
. test 

if [ $? - eq 0 ]   

then whiptail --title "Message " --msgbox "successfull" 10 40 && echo "yeiiieieieieieieieiei";

else whiptail --title "Message" --msgbox "failed" 10 40  && echo "failure..... :(   ";
fi

when I run this script... following error is show.
ERROR shown as :

/usr/bin/test: line 1: ELF: command not found
#!/bin/sh
./test 

if [ $? -eq 0 ]; then 
   whiptail --title "Message " --msgbox "successfull" 10 40 && echo "yeiiieieieieieieieiei"
else 
   whiptail --title "Message" --msgbox "failed" 10 40  && echo "failure..... :(   "
fi

Following error is shown:

function2.sh: line 15: [: too many arguments

I see only 7 lines in the posted script.
Please post the entire script 'as is'.