I have written the following code for the linked list and now I want to test whether my function work correctly or not. Can anyone please show how to test those functions.
Just go ahead and test it. You're the one who knows what it's supposed to do. Push some things, pop some things, go crazy.
Although the pop function seems like maybe it's supposed to return the value? Possibly thorugh a reference?
And you're creating a lot of "new nodes" that are then just tossed away. It's as if you think you can't declare a pointer without allocating some new memory to it. Not so! If you want temp to point to head, just say node *temp = head.
Lines 40, 50, and 64: you sometimes leak the memory allocated here.
Line 58. If this is the last item then you need to update tail too.
push_back() does the same thing that createnode() does, only slower and with bugs. It's slow because it walks through the list. It has bugs because it doesn't update tail. Perhaps createnode() is supposed to insert at the front?
You should have a destructor that deallocates all the nodes.