In order to test the expansion of the universe and its geometry, we carry out an Alcock & Paczynski cosmological test, that is, an evaluation of the ratio of observed angular size to radial/redshift size. The main advantage of this test is that it does not depend on the evolution of the galaxies, but only on the geometry of the universe. However, the redshift distortions produced by the peculiar velocities of the gravitational infall do also have an influence, which should be separated from the cosmological effect. We derive the anisotropic correlation function of sources in three surveys within the Sloan Digital Sky Survey (SDSS): galaxies from SDSS-III/Baryon Oscillation Spectroscopy Survey-Data Release 10 (BOSS-DR10), and QSOs from SDSS-II and SDSS-III/BOSS-DR10. From these, we are able to disentangle the dynamic and geometric distortions and thus derive the ratio of observed angular size to radial/redshift size at different redshifts. We also add some other values available in the literature. Then, we use the data to evaluate which cosmological model fits them. We used six different models: concordance Lambda-CDM, Einstein-de Sitter, open-Friedman Cosmology without dark energy, flat quasi-steady state cosmology, a static universe with a linear Hubble law, and a static universe with tired-light redshift. Only two of the six models above fit the data of the Alcock & Paczynski test: concordance Lambda-CDM and static universe with tired-light redshift; whereas the rest of them are excluded at a >95% confidence level. If we assume that Lambda-CDM is the correct one, the best fit with a free Omega_m is produced for Omega_m=0.24^{+0.10}_{-0.07}.