• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão6585a42991cdcc40606934a01ee19472bed10961 (tree)
Hora2017-05-03 22:42:41
Autordhrname <dhrname@user...>
Commiterdhrname

Mensagem de Log

New the ST_pop function

Mudança Sumário

Diff

--- a/source_code/shadowstar.c
+++ b/source_code/shadowstar.c
@@ -578,6 +578,11 @@ ST_Stack_List ST_push (double value, ST_Stack_List stack)
578578 * スタックからは取り除かれる*/
579579 double ST_pop (ST_Stack_List stack)
580580 {
581+ if (ST_isEmpty(*stack))
582+ {
583+ /*スタックリストが空リストであれば、ST_EMPTYの値である0.0を返す*/
584+ return 0.0;
585+ }
581586 /*stackの解放用変数*/
582587 ST_Ordered_Pair *stackfree = NULL;
583588
Binary files a/source_code/shadowstar.o and b/source_code/shadowstar.o differ
--- a/source_code/startest.c
+++ b/source_code/startest.c
@@ -382,6 +382,20 @@ int main(int argc, char **argv)
382382 assert(ST_first(*stack) == 0);
383383 assert(ST_push(1, stack) == stack);
384384 assert(ST_first(*stack) == 1);
385+ ST_push(3, stack);
386+ ST_push(5, stack);
387+ assert(ST_first(*stack) == 5);
388+ assert(ST_first(ST_second(*stack)) == 3);
389+ assert(ST_pop(stack) == 5);
390+ assert(ST_first(*stack) == 3);
391+ assert(ST_pop(stack) == 3);
392+ assert(ST_first(*stack) == 1);
393+ assert(ST_pop(stack) == 1);
394+ assert(ST_first(*stack) == 0);
395+ assert(ST_isEmpty(*stack));
396+ assert(ST_pop(stack) == 0);
397+ assert(ST_isEmpty(*stack));
398+ ST_freelist(*stack);
385399 ST_freelist(ppp);
386400
387401 eprint_log("Error!\n");
Binary files a/source_code/startest.o and b/source_code/startest.o differ