Normally to differentiate between a HDD and an SSD you would test for rotational speed greater than 0. if speed equals 0 drive is SSD, if speed is greater than 0 drive is HDD
hdparm will report an SSD as "nominal media rotation rate: Solid State Drive"
sudo hdparm -I /dev/sda? | grep 'Rotation'
Since the rotational speed can be misrepresented this next test is considered definitive.
test for random 4k read performance with 8MB/s transfer speed set as a threshold speed. As very few HDD's are capable of 4K random read performance greater than 2MB/s (iirc there are maybe two SCSI drives which are close to this performance), any result less than this is definitely a HDD whilst any result above this clearly indicates an SSD.