How exactly does cover work in Frozen Synapse?

When a unit is behind cover, the amount of time between when an enemy unit spots the covered unit and when the enemy unit starts firing is increased. If, under normal circumstances, the two units would have equal time between spotting and firing, the unit behind cover will have the advantage and will win the engagement.

Whether or not a unit is considered behind cover depends on both units' distance from that cover. If the cover is more than two thirds the distance away from a unit, that unit will take longer to start firing.

Consider the following: a green machine gunner and a red machine gunner have spotted each other at the same time with cover somewhere between them.

  R----------|--------------------G      Red has cover

  R---------------|---------------G      neither have cover

  R--------------------|----------G      Green has cover

And in the case of two objects of cover or wide cover...

  R--|          ~          |------G      Red has cover

  R----|          ~          |----G      neither have cover

  R------|          ~          |--G      Green has cover

Note that the only distance that matters is that between the unit and the closest edge of cover. I don't believe anything between that closest edge and the unit being fired upon affects the outcome.

I deduced this from testing within the game using the level editor. In cases where neither unit has cover, green (team 1) always wins. I hope this is limited to the level editor.