There are various instruments (used by Gemmologists) & some Jewellers, the Thermal probe mentioned above is one, plus others that measure light refraction, spectra, specific gravity & viewing by microscope, among them.
Naturally, one has to be trained in their use, & identifications in the gem world are a minefield for the novice.
New synthetics & processes are being developed all the time.
To be sure, you have to take it to an expert.
Here's 2 scenario's to consider.
1. It costs you money by taking it to an expert to find out it's glass. (the likely outcome)
2. You save money by not getting expert opinion & sell it as cheap glass, only to find out later that it was a Diamond! (less likely outcome)
Both rotten options I know, but if you can get at least some free semi expert opinion, that would be the way to go.