If I knew we were going to have a test today, I would have studied harder yesterday.
If I had known we were going to have a test today, I would have studied more yesterday.
どちらも「今日テストがあると知っていたら、昨日もっと勉強したのに」という意味です。
「今日テストがある」の部分は
we were going to have a test today
のように表現します。
ーIf I knew we were going to have a test today, I would have studied harder yesterday.
*こちらは口語的な言い方です。会話ではこのように言うネイティブが多いと思います。
ーIf I had known we were going to have a test today, I would have studied more yesterday.
*こちらは文法的に正しい言い方です。
ご参考まで!