When you compare each sample to a "known truth", you would use the (independent) one-sample t-test. If you are comparing two samples not strictly related to each other, the independent two-sample t-test is used.
Any single sample statistical test that uses t-distribution can be called a 'one-sample t-test'. This test is used when we have a random sample and we want to test if it is significantly different from a population mean.
Generally speaking, this test involves testing the null hypothesis H0: μ = μ0 against the alternative hypothesis, H1: μ ≠ μ0 where μ is the population mean and μ0 is a specific value of the population mean that we would like to test for acceptance.
An example may clarify the calculation and hypothesis testing of the independent one-sample t-test better.
Suppose that the teacher of a school claims that an average student of his school studies 8 hours per day during weekends and we desire to test the truth of this claim.
The statistical methodology for this purpose requires that we begin by first specifying the hypothesis to be tested.
In this case, the null hypothesis would be H0: μ = 8, which essentially states that mean hours of study per day is no different from 8 hours. And the alternative hypothesis is, H1: μ ≠ 8, which is negation of the teacher's claim.
In the next step, we take a sample of say 10 students of the school and collect data on how long they study during weekends.
These 10 different study hours is our data.
Suppose that the sample mean turns out to be 6.5 hours.
We cannot infer anything directly from this mean - as to whether the claim is to be accepted or rejected as it could very well have happened that by sheer luck (even though the sample was drawn randomly). Students included in the sample may have been those who studied fewer than 8 hours.
On the other hand, it could also be the case that the claim was indeed inappropriate.
To draw a scientifically valid conclusion, we can perform an independent one-sample t-test which helps us to either accept or reject the null hypothesis.
If the null hypothesis is rejected, it means that the sample came from a population with mean study hours significantly different from 8 hours.
On the other hand if the null hypothesis is accepted, it means that there is no evidence to suggest that average study hours were significantly different from 8 hours - thereby establishing evidence of the claim.
This test is one of the most popular small sample test widely used in all disciplines - medicine, behavioral science, physical science etc. However, this test can be used only if the background assumptions are satisfied.
The population from which the sample has been drawn should be normal - appropriate statistical methods exist for testing this assumption (For example the Kolmogorov Smirnov non parametric test). It has however been shown that minor departures from normality do not affect this test - this is indeed an advantage.
This test is a small sample test. It is difficult to draw the clearest line of demarcation between large and small samples. Statisticians have generally agreed that a sample may be considered small if its size is < 30 (less than 30).
The test used for dealing with problems relating the large samples are different from the one used for small samples. We often use z-test for large samples.